cloudos_cli.utils.requests¶
Specific functions to wrapp error strategy for requests
Functions
|
Wrap normal requests DELETE with an error retry strategy. |
|
Wrap normal requests get with an error strategy. |
|
Wrap normal requests post with an error strategy. |
|
Wrap normal requests put with an error strategy. |
- cloudos_cli.utils.requests.retry_requests_delete(url, total=5, status_forcelist=[429, 500, 502, 503, 504], **kwargs)[source]¶
Wrap normal requests DELETE with an error retry strategy.
- Parameters:
url (str) – The request URL.
total (int) – Total number of retry attempts.
status_forcelist (list of int) – HTTP status codes that should trigger a retry.
**kwargs – Additional keyword arguments passed to requests.delete.
- Returns:
The Response object returned by the API server.
- Return type:
requests.Response
- cloudos_cli.utils.requests.retry_requests_get(url, total=5, status_forcelist=[429, 500, 502, 503, 504], **kwargs)[source]¶
Wrap normal requests get with an error strategy.
- Parameters:
url (string) – The request URL
total (int) – Total number of retries
status_forcelist (list) – A list of ints with the status codes to trigger the retries
- Returns:
response – The Response object returned by the API server
- Return type:
requests.Response
- cloudos_cli.utils.requests.retry_requests_post(url, total=5, status_forcelist=[429, 500, 502, 503, 504], **kwargs)[source]¶
Wrap normal requests post with an error strategy.
- Parameters:
url (string) – The request URL
total (int) – Total number of retries
status_forcelist (list) – A list of ints with the status codes to trigger the retries
- Returns:
response – The Response object returned by the API server
- Return type:
requests.Response
- cloudos_cli.utils.requests.retry_requests_put(url, total=5, status_forcelist=[429, 500, 502, 503, 504], **kwargs)[source]¶
Wrap normal requests put with an error strategy.
- Parameters:
url (string) – The request URL
total (int) – Total number of retries
status_forcelist (list) – A list of ints with the status codes to trigger the retries
- Returns:
response – The Response object returned by the API server
- Return type:
requests.Response