-
Notifications
You must be signed in to change notification settings - Fork 405
Description
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:
github3.py/src/github3/repos/repo.py
Line 1392 in 62367c9
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?