pybiolib 1.1.930__py3-none-any.whl → 1.1.940__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
biolib/api/client.py CHANGED
@@ -1,8 +1,10 @@
1
+ import time
1
2
  from urllib.parse import urljoin
2
3
 
3
4
  import requests
4
5
  from requests import Response, HTTPError
5
6
 
7
+ from biolib.biolib_logging import logger_no_user_data
6
8
  from biolib.typing_utils import Dict, Optional, Union
7
9
  from biolib.biolib_api_client import BiolibApiClient as DeprecatedApiClient
8
10
 
@@ -16,14 +18,29 @@ class ApiClient:
16
18
  headers: Optional[Dict[str, str]] = None,
17
19
  authenticate: bool = True,
18
20
  ) -> Response:
19
- response = requests.get(
20
- headers=self._get_headers(headers, authenticate),
21
- params=params,
22
- timeout=10,
23
- url=self._get_absolute_url(url),
24
- )
25
- ApiClient.raise_for_status(response)
26
- return response
21
+ retries = 5
22
+ for retry_count in range(retries):
23
+ if retry_count > 0:
24
+ time.sleep(1 * retry_count)
25
+ logger_no_user_data.debug('Retrying HTTP GET request...')
26
+ try:
27
+ response = requests.get(
28
+ headers=self._get_headers(headers, authenticate),
29
+ params=params,
30
+ timeout=10,
31
+ url=self._get_absolute_url(url),
32
+ )
33
+ if response.status_code == 502:
34
+ logger_no_user_data.debug('Got 502 status for HTTP GET')
35
+ continue
36
+
37
+ ApiClient.raise_for_status(response)
38
+ return response
39
+ except requests.exceptions.ReadTimeout:
40
+ logger_no_user_data.debug('Got read timeout of HTTP GET request')
41
+ continue
42
+
43
+ raise Exception(f'Failed to complete HTTP GET request for "{url}" after {retries} retries')
27
44
 
28
45
  def post(self, path: str, data: Dict, headers: Optional[Dict[str, str]] = None) -> Response:
29
46
  response = requests.post(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.930
3
+ Version: 1.1.940
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -2,7 +2,7 @@ LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
2
2
  README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
3
3
  biolib/__init__.py,sha256=YZViewYPnI3Ih4Zk2hULwVjYA3Rp1ILj0kOCUvKbZYI,3337
4
4
  biolib/api/__init__.py,sha256=fhsbqVxDYfQ2NMYKkFW-msplAa1YPllfKEkAtLdD9IM,95
5
- biolib/api/client.py,sha256=o8KhOMoOluXGSfiIQ-2GQ_wp37R1ZB04KdevrAZPPDs,2969
5
+ biolib/api/client.py,sha256=9dOU-T6xzQS4Hx_6Jq3lY2EA-oulPqoWoqkVE2H7er8,3744
6
6
  biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
7
7
  biolib/app/app.py,sha256=nF_aBvNss-ZT-rQQQf4OaKwWA5EiTNkZA9QLC22ElvU,7652
8
8
  biolib/app/search_apps.py,sha256=22rJ_vIxA5GKC6wdDIAjMCe5eOPoPD4BYZuyQ0OddW8,1493
@@ -106,8 +106,8 @@ biolib/validators/validate_argument.py,sha256=B-tqgMgXuTvJLhaMWcBTUKw18L5brJtIdf
106
106
  biolib/validators/validate_module.py,sha256=aHe0YAWFSrMbZNw-h64oweqruDS-k7KOUzK1ECpG8Wg,13298
107
107
  biolib/validators/validate_zip_file.py,sha256=2j8kJ1WF2u5OyMkfEDCoU_BvOtr8gLPWTtsmUG0zQ5g,1655
108
108
  biolib/validators/validator_utils.py,sha256=2QCJWdKiLTUHsvjDidrXKBjH95kKsEmFwd17muTGL0M,2135
109
- pybiolib-1.1.930.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
110
- pybiolib-1.1.930.dist-info/METADATA,sha256=zo7r8ml_2hZx2dqZCULCxbsb7yIChAZqdRpRFhHJ564,1611
111
- pybiolib-1.1.930.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
112
- pybiolib-1.1.930.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
113
- pybiolib-1.1.930.dist-info/RECORD,,
109
+ pybiolib-1.1.940.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
110
+ pybiolib-1.1.940.dist-info/METADATA,sha256=N0wn9fdGgTGqIoJbp39xYcWqkr-QTes5IrfqJV8YCiA,1611
111
+ pybiolib-1.1.940.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
112
+ pybiolib-1.1.940.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
113
+ pybiolib-1.1.940.dist-info/RECORD,,