githubpy icon indicating copy to clipboard operation
githubpy copied to clipboard

Updating different files in the same repo at the same time return 409 conflict error

Open deepakdialpad opened this issue 1 year ago • 1 comments

I am trying to use the githubpy library in my setup. My requirement is to update multiple different files in the repo. The request to update the files in git happens almost at the same time. Sample code is like below. This is called with different file names from different places.

github_client = github.GitHub(access_token=access_token)
file_content = base64.b64encode(some_data).decode()
response = (github_client.repos(owner)(repo)('contents')(file_name)
                .put({'message': message,
                      'content': file_content,
                      'sha': file_sha,
                      'branch': branch}))

The first file update is successful but the subsequent file updated fail. With this we always get the error. Error 409: Conflict

May i know is there a limitation on the githubpy library in doing this operation ?

deepakdialpad avatar Aug 11 '23 08:08 deepakdialpad

Hi, githubpy is only a wrapper for the REST APIs. You can use GitHub(access_token='xxx', debug=True) to log and execute the curl command manually. If curl failed then there is something wrong with the args.

michaelliao avatar Aug 12 '23 16:08 michaelliao