Skip to content

Can we expose the timeout parameter to Repository.create_tree() to create large tree objects? #1187

Description

@rduve

Currently, when trying to create a tree with large data there is a timeout error:

import github3

gh = github3.login(token=<token>)
repo = gh.repository(<org>, <repo>)
...
# Make big tree_data and tree_sha here.
...
tree = repo.create_tree(tree_data, tree_sha)

github3.exceptions.ConnectionError: <class 'requests.exceptions.ReadTimeout'>: A connection-level exception occurred: HTTPSConnectionPool(host='api.github.com', port=443): Read timed out. (read timeout=10)

Specifically, that tree_data object has 1610 blobs and is about 300 KB serialized.

Manually adding a timeout=60 to the self._post() in that function:

json = self._json(self._post(url, data=data), 201)

allows the tree to successfully be created.

My goal is to not get the timeout when executing create_tree. Would it be a helpful addition to github3 if that timeout could be specified without patching the _post function? If not, would a PR that adds timeout to the create_tree function contract be welcome?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions