retry_post¶
- snpit_utils.http.retry_post(url, json=None, data=None, retries=5, initsleep=1.0, sleepfac=1.5, fuzz=True, **kwargs)[source]¶
Do a python requests post to url, retrying on failures.
- Parameters:
url (str) – url to POST to
json (dict, default None) – What to give the the json= parmaeter of requests.post
data (dict, default None) – What to give the data= parmaeter of requests.post
retries (int, default 5) – Number of times to retry before giving up for good
initsleep (float, default 1.) – Sleep this many seconds after the first failure.
sleepfac (float, default 1.5) – Increase the sleeptime by this factor after each failure
fuzz (bool, default True) – Randomly scatter the sleeptime by ~1/5 of the current sleeptime. This is so if you have a bunch of processes all going at once, they don’t accidentally sync up.
verify (bool, default True) – Set false to not verify certs. You usually want this True, may need to set it to False for tests or some such.
**kwargs (further arguments are forwarded to requests.post.)
- Return type:
requests.Response