getting not json serializable while uploading fiels to github with api

Viewed 14

I want to upload files to GitHub with GitHub API and different file types just text files. i have written this but getting error while executing can anyone point out mistake I am doing

      OWNER = ""
       REPO = ""
       GITHUB_TOKEN = ""
       PATH = ""
       COMMIT_MESSAGE = "sonar.projectKey={repo}\nsonar.organization={owner}"
       CONTENT = base64.b64encode(CONTENT).encode("utf-8")

       url = f"https://api.github.com/repos/{OWNER}/{REPO}/contents/{PATH}"
       print(url)
       response = requests.put(url, json={
           "message": COMMIT_MESSAGE,
           "content": CONTENT.decode("utf-8")
       }, headers={
           "Authorization": f"token {GITHUB_TOKEN}"
       })
       print(response.json())

0 Answers
Related