Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2bdf55

Browse files
committed
Increase default read timeout to 10 seconds
The read timeout is the time until Github starts the response to anhttp request. The current default of one second can be too short for alocal maybe slower Github Enterprise. Instead change it to 10s asgithub suggests also in its best practices for request from Github tointegrations [1].[1]https://developer.github.com/v3/guides/best-practices-for-integrators/#favor-asynchronous-work-over-synchronous
1 parent5deccee commitc2bdf55

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/github3/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class GitHubSession(requests.Session):
9393
"two_factor_auth_cb",
9494
]
9595

96-
def__init__(self,default_connect_timeout=4,default_read_timeout=1):
96+
def__init__(self,default_connect_timeout=4,default_read_timeout=10):
9797
"""Slightly modify how we initialize our session."""
9898
super(GitHubSession,self).__init__()
9999
self.default_connect_timeout=default_connect_timeout

‎tests/unit/test_github_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_default_timeout(self, request_mock):
4141
assertrisresponse
4242
request_mock.assert_called_once_with(
4343
"GET","http://example.com",allow_redirects=True,
44-
timeout=(4,1)
44+
timeout=(4,10)
4545
)
4646

4747
@mock.patch.object(requests.Session,'request')
@@ -149,7 +149,7 @@ def test_request_ignores_responses_that_do_not_require_2fa(
149149
assertrisresponse
150150
request_mock.assert_called_once_with(
151151
"GET","http://example.com",allow_redirects=True,
152-
timeout=(4,1)
152+
timeout=(4,10)
153153
)
154154

155155
@mock.patch.object(requests.Session,"request")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp