FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add timeout to UserSecretsClient · agamat/docker-python@fe26648 · GitHub

Commit fe26648

Browse files
committed
Add timeout to UserSecretsClient
1 parent a16bc4b commit fe26648

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎patches/kaggle_secrets.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
_KAGGLE_DEFAULT_URL_BASE = "https://www.kaggle.com"
1212
_KAGGLE_URL_BASE_ENV_VAR_NAME = "KAGGLE_URL_BASE"
1313
_KAGGLE_USER_SECRETS_TOKEN_ENV_VAR_NAME = "KAGGLE_USER_SECRETS_TOKEN"
14+
TIMEOUT_SECS = 10
1415

1516

1617
class CredentialError(Exception):
@@ -43,7 +44,7 @@ def _make_post_request(self, data):
4344
req = urllib.request.Request(url, headers=self.headers, data=bytes(
4445
json.dumps(request_body), encoding="utf-8"))
4546
try:
46-
with urllib.request.urlopen(req) as response:
47+
with urllib.request.urlopen(req, timeout=TIMEOUT_SECS) as response:
4748
response_json = json.loads(response.read())
4849
if not response_json.get('wasSuccessful') or 'result' not in response_json:
4950
raise BackendError(

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL