| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ | |||
| 11 | 11 | _KAGGLE_DEFAULT_URL_BASE = "https://www.kaggle.com" | |
| 12 | 12 | _KAGGLE_URL_BASE_ENV_VAR_NAME = "KAGGLE_URL_BASE" | |
| 13 | 13 | _KAGGLE_USER_SECRETS_TOKEN_ENV_VAR_NAME = "KAGGLE_USER_SECRETS_TOKEN" | |
| 14 | + TIMEOUT_SECS = 10 | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | class CredentialError(Exception): | |
@@ -43,7 +44,7 @@ def _make_post_request(self, data): | |||
| 43 | 44 | req = urllib.request.Request(url, headers=self.headers, data=bytes( | |
| 44 | 45 | json.dumps(request_body), encoding="utf-8")) | |
| 45 | 46 | try: | |
| 46 | - with urllib.request.urlopen(req) as response: | ||
| 47 | + with urllib.request.urlopen(req, timeout=TIMEOUT_SECS) as response: | ||
| 47 | 48 | response_json = json.loads(response.read()) | |
| 48 | 49 | if not response_json.get('wasSuccessful') or 'result' not in response_json: | |
| 49 | 50 | raise BackendError( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments