Commit dd046a1813133dce05e665e16de4d87c8253ed3d
Committed by
OrysiaDrabych
1 parent
959a77b6
Update openprocurement_client_helper.py
To work with contracting management procedure
Showing
1 changed file
with
11 additions
and
0 deletions
| ... | ... | @@ -2,6 +2,7 @@ from openprocurement_client.client import Client, EDRClient |
| 2 | 2 | from openprocurement_client.document_service_client \ |
| 3 | 3 | import DocumentServiceClient |
| 4 | 4 | from openprocurement_client.plan import PlansClient |
| 5 | +from openprocurement_client.contract import ContractingClient | |
| 5 | 6 | from openprocurement_client.exceptions import IdNotFound |
| 6 | 7 | from restkit.errors import RequestFailed, BadStatusLine, ResourceError |
| 7 | 8 | from retrying import retry |
| ... | ... | @@ -43,6 +44,16 @@ def prepare_ds_api_wrapper(ds_host_url, auth_ds): |
| 43 | 44 | return StableDsClient(ds_host_url, auth_ds) |
| 44 | 45 | |
| 45 | 46 | |
| 47 | +class ContractingStableClient(ContractingClient): | |
| 48 | + @retry(stop_max_attempt_number=100, wait_random_min=500, wait_random_max=4000, retry_on_exception=retry_if_request_failed) | |
| 49 | + def request(self, *args, **kwargs): | |
| 50 | + return super(ContractingStableClient, self).request(*args, **kwargs) | |
| 51 | + | |
| 52 | + | |
| 53 | +def prepare_contract_api_wrapper(key, host_url, api_version): | |
| 54 | + return ContractingStableClient(key, host_url, api_version) | |
| 55 | + | |
| 56 | + | |
| 46 | 57 | class StableEDRClient(EDRClient): |
| 47 | 58 | @retry(stop_max_attempt_number=100, wait_random_min=500, |
| 48 | 59 | wait_random_max=4000, retry_on_exception=retry_if_request_failed) | ... | ... |
Please
register
or
login
to post a comment