ebi-eva-common-pyutils 0.7.2__py3-none-any.whl → 0.7.4__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.
- ebi_eva_common_pyutils/biosamples_communicators.py +13 -3
- ebi_eva_common_pyutils/config.py +2 -3
- ebi_eva_common_pyutils-0.7.4.dist-info/METADATA +30 -0
- {ebi_eva_common_pyutils-0.7.2.dist-info → ebi_eva_common_pyutils-0.7.4.dist-info}/RECORD +8 -8
- {ebi_eva_common_pyutils-0.7.2.dist-info → ebi_eva_common_pyutils-0.7.4.dist-info}/WHEEL +1 -1
- ebi_eva_common_pyutils-0.7.2.dist-info/METADATA +0 -24
- {ebi_eva_common_pyutils-0.7.2.data → ebi_eva_common_pyutils-0.7.4.data}/scripts/archive_directory.py +0 -0
- {ebi_eva_common_pyutils-0.7.2.dist-info → ebi_eva_common_pyutils-0.7.4.dist-info}/LICENSE +0 -0
- {ebi_eva_common_pyutils-0.7.2.dist-info → ebi_eva_common_pyutils-0.7.4.dist-info}/top_level.txt +0 -0
|
@@ -25,11 +25,18 @@ class HALNotReadyError(Exception):
|
|
|
25
25
|
pass
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
# Extends ValueError so clients can still expect ValueErrors to be raised on failed requests,
|
|
29
|
+
# but we have a more specific class internally to know when to retry.
|
|
30
|
+
class HttpErrorRetry(ValueError):
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
28
34
|
class HALCommunicator(AppLogger):
|
|
29
35
|
"""
|
|
30
36
|
This class helps navigate through REST API that uses the HAL standard.
|
|
31
37
|
"""
|
|
32
38
|
acceptable_code = [200, 201]
|
|
39
|
+
no_retry_code = [404]
|
|
33
40
|
|
|
34
41
|
def __init__(self, auth_url, bsd_url, username, password):
|
|
35
42
|
self.auth_url = auth_url
|
|
@@ -43,9 +50,12 @@ class HALCommunicator(AppLogger):
|
|
|
43
50
|
self.error(response.request.method + ': ' + response.request.url + " with " + str(response.request.body))
|
|
44
51
|
self.error("headers: {}".format(response.request.headers))
|
|
45
52
|
self.error("<{}>: {}".format(response.status_code, response.text))
|
|
46
|
-
|
|
53
|
+
error_msg = 'The HTTP status code ({}) is not one of the acceptable codes ({})'.format(
|
|
47
54
|
str(response.status_code), str(self.acceptable_code))
|
|
48
|
-
|
|
55
|
+
if response.status_code in self.no_retry_code:
|
|
56
|
+
raise ValueError(error_msg)
|
|
57
|
+
else:
|
|
58
|
+
raise HttpErrorRetry(error_msg)
|
|
49
59
|
return response
|
|
50
60
|
|
|
51
61
|
@cached_property
|
|
@@ -55,7 +65,7 @@ class HALCommunicator(AppLogger):
|
|
|
55
65
|
self._validate_response(response)
|
|
56
66
|
return response.text
|
|
57
67
|
|
|
58
|
-
@retry(exceptions=(
|
|
68
|
+
@retry(exceptions=(HttpErrorRetry, requests.RequestException), tries=3, delay=2, backoff=1.2, jitter=(1, 3))
|
|
59
69
|
def _req(self, method, url, **kwargs):
|
|
60
70
|
"""Private method that sends a request using the specified method. It adds the headers required by bsd"""
|
|
61
71
|
headers = kwargs.pop('headers', {})
|
ebi_eva_common_pyutils/config.py
CHANGED
|
@@ -11,10 +11,9 @@ class Configuration:
|
|
|
11
11
|
Configuration class that allow to load a yaml file either at construction or later in the execution.
|
|
12
12
|
It can be used like a dict but should be used as readonly.
|
|
13
13
|
"""
|
|
14
|
-
config_file = None
|
|
15
|
-
content = {}
|
|
16
|
-
|
|
17
14
|
def __init__(self, *search_path):
|
|
15
|
+
self.config_file = None
|
|
16
|
+
self.content = {}
|
|
18
17
|
if search_path:
|
|
19
18
|
self.load_config_file(*search_path)
|
|
20
19
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: ebi_eva_common_pyutils
|
|
3
|
+
Version: 0.7.4
|
|
4
|
+
Summary: EBI EVA - Common Python Utilities
|
|
5
|
+
Home-page: https://github.com/EBIVariation/eva-common-pyutils
|
|
6
|
+
License: Apache
|
|
7
|
+
Keywords: EBI,EVA,PYTHON,UTILITIES
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests==2.*
|
|
15
|
+
Requires-Dist: lxml==5.*
|
|
16
|
+
Requires-Dist: pyyaml==6.*
|
|
17
|
+
Requires-Dist: cached-property==1.5.*
|
|
18
|
+
Requires-Dist: retry==0.*,>0.9
|
|
19
|
+
Requires-Dist: openpyxl==3.*
|
|
20
|
+
Provides-Extra: eva-internal
|
|
21
|
+
Requires-Dist: psycopg2-binary; extra == "eva-internal"
|
|
22
|
+
Requires-Dist: pymongo<=3.12; extra == "eva-internal"
|
|
23
|
+
Requires-Dist: networkx<=2.5; extra == "eva-internal"
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: keywords
|
|
27
|
+
Dynamic: license
|
|
28
|
+
Dynamic: provides-extra
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: summary
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ebi_eva_common_pyutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
ebi_eva_common_pyutils/assembly_utils.py,sha256=CklyCGlCjlFp0e9pugg6kSsh5L0xfCe2qPvA2eLVtn0,4187
|
|
3
|
-
ebi_eva_common_pyutils/biosamples_communicators.py,sha256=
|
|
3
|
+
ebi_eva_common_pyutils/biosamples_communicators.py,sha256=ZkemchAYGrHwqbGviJN5X80nYFizDNVTwUX3c_5PZcM,7799
|
|
4
4
|
ebi_eva_common_pyutils/command_utils.py,sha256=PtelWWqcC0eOwIVesjwBw3F9KaXRzEE_uAUJhQFZ4l8,2340
|
|
5
5
|
ebi_eva_common_pyutils/common_utils.py,sha256=ty_glvfRa3VGhnpAht4qtVkNNmv-IYfVtO958mY-BaA,1192
|
|
6
|
-
ebi_eva_common_pyutils/config.py,sha256=
|
|
6
|
+
ebi_eva_common_pyutils/config.py,sha256=evkOyPub8dXg44sNiZJR-nHq2C8XTVSVk92M37C5eR4,5124
|
|
7
7
|
ebi_eva_common_pyutils/ena_utils.py,sha256=S2MmnWQ_9MJjlkaQY_by1-GGbTyi8SKp8XRcpjWnpZs,1465
|
|
8
8
|
ebi_eva_common_pyutils/file_utils.py,sha256=eIlQKSVKkEjMNX7emrDzaQyQdGvQdb64gnfEhb6uYsE,1375
|
|
9
9
|
ebi_eva_common_pyutils/logger.py,sha256=2BXA-dQFkVAyLrF1kC24GcLGxRMaQhJpt41NQv7jpks,5941
|
|
@@ -22,7 +22,7 @@ ebi_eva_common_pyutils/taxonomy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
|
22
22
|
ebi_eva_common_pyutils/taxonomy/taxonomy.py,sha256=aXmRQ3NAaJotwmmOA2-u2XtcUT6iih-0_e-3QOxynoA,2578
|
|
23
23
|
ebi_eva_common_pyutils/variation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
ebi_eva_common_pyutils/variation/contig_utils.py,sha256=kMNEW_P2yPnd8Xx1tep19hy5ee7ojxz6ZOO1grTQsRQ,5230
|
|
25
|
-
ebi_eva_common_pyutils-0.7.
|
|
25
|
+
ebi_eva_common_pyutils-0.7.4.data/scripts/archive_directory.py,sha256=0lWJ0ju_AB2ni7lMnJXPFx6U2OdTGbe-WoQs-4BfKOM,4976
|
|
26
26
|
ebi_eva_internal_pyutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
ebi_eva_internal_pyutils/archive_directory.py,sha256=IxVEfh_gaCiT652k0Q_-58fonRusy1yzXu7BCO8yVLo,4989
|
|
28
28
|
ebi_eva_internal_pyutils/config_utils.py,sha256=EGRC5rsmU_ug7OY9-t1UW1XZXRsauSyZB9xPcBux8ts,7909
|
|
@@ -34,8 +34,8 @@ ebi_eva_internal_pyutils/mongodb/__init__.py,sha256=0oyTlkYZCV7udlPl09Zl-sDyE3c9
|
|
|
34
34
|
ebi_eva_internal_pyutils/mongodb/mongo_database.py,sha256=kesaJaaxYFeF_uYZBgL8tbufGKUXll7bXb4WlOS9vKM,9596
|
|
35
35
|
ebi_eva_internal_pyutils/nextflow/__init__.py,sha256=OOiJS8jZOz98q0t77NNog7aI_fFrVxi4kGmiSskuAqM,122
|
|
36
36
|
ebi_eva_internal_pyutils/nextflow/nextflow_pipeline.py,sha256=ew623hhK8jmFLQjJwLZbgBmW9RTiJBEULVqHfIUv_dc,10114
|
|
37
|
-
ebi_eva_common_pyutils-0.7.
|
|
38
|
-
ebi_eva_common_pyutils-0.7.
|
|
39
|
-
ebi_eva_common_pyutils-0.7.
|
|
40
|
-
ebi_eva_common_pyutils-0.7.
|
|
41
|
-
ebi_eva_common_pyutils-0.7.
|
|
37
|
+
ebi_eva_common_pyutils-0.7.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
38
|
+
ebi_eva_common_pyutils-0.7.4.dist-info/METADATA,sha256=-dqz8UYrpmrdcGIKdkgV4m8slivOqND7OM-__q9Fs0s,1022
|
|
39
|
+
ebi_eva_common_pyutils-0.7.4.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
40
|
+
ebi_eva_common_pyutils-0.7.4.dist-info/top_level.txt,sha256=sXoiqiGU8vlMQpFWDlKrekxhlusk06AhkOH3kSvDT6c,48
|
|
41
|
+
ebi_eva_common_pyutils-0.7.4.dist-info/RECORD,,
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ebi-eva-common-pyutils
|
|
3
|
-
Version: 0.7.2
|
|
4
|
-
Summary: EBI EVA - Common Python Utilities
|
|
5
|
-
Home-page: https://github.com/EBIVariation/eva-common-pyutils
|
|
6
|
-
License: Apache
|
|
7
|
-
Keywords: EBI,EVA,PYTHON,UTILITIES
|
|
8
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: Topic :: Software Development :: Build Tools
|
|
11
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: requests (==2.*)
|
|
15
|
-
Requires-Dist: lxml (==5.*)
|
|
16
|
-
Requires-Dist: pyyaml (==6.*)
|
|
17
|
-
Requires-Dist: cached-property (==1.5.*)
|
|
18
|
-
Requires-Dist: retry (==0.*,>0.9)
|
|
19
|
-
Requires-Dist: openpyxl (==3.*)
|
|
20
|
-
Provides-Extra: eva-internal
|
|
21
|
-
Requires-Dist: psycopg2-binary ; extra == 'eva-internal'
|
|
22
|
-
Requires-Dist: pymongo ; extra == 'eva-internal'
|
|
23
|
-
Requires-Dist: networkx (<=2.5) ; extra == 'eva-internal'
|
|
24
|
-
|
{ebi_eva_common_pyutils-0.7.2.data → ebi_eva_common_pyutils-0.7.4.data}/scripts/archive_directory.py
RENAMED
|
File without changes
|
|
File without changes
|
{ebi_eva_common_pyutils-0.7.2.dist-info → ebi_eva_common_pyutils-0.7.4.dist-info}/top_level.txt
RENAMED
|
File without changes
|