https://github.com/psf/requests/issues/1393
I'm a bit confused after reading the above post.
import requests
from requests.adapters import HTTPAdapter
s = requests.Session()
s.mount('https://', HTTPAdapter(max_retries=3))
data = s.get(MY_URL, timeout=10)
My understanding is that in 10 seconds, if there is no return value, there will be a timeout, and there will be no retries. What I want is for it to retry 3 times, and each try has a timeout of 10 seconds. How can I achieve this?
I realized my understanding was wrong. If the number of retries is 3, and the timeout is 10, it will try 10 seconds for each of the 3 retries.
https://www.peterbe.com/plog/best-practice-with-retries-with-requests
"Works In Conjunction With timeout" provides a good example, I just didn't understand it before.
Related
Does anyone know whether the HERE Isoline Routing API has a limit on how many hours you can plug in?
For example, 6 hours works perfectly fine and has a service area output:
'https://isoline.router.hereapi.com/v8/isolines?transportMode=car&origin=52.51578,13.37749&range[type]=distance&range[values]=21600&routingMode=fast'
However, I get a error if I try and do 12 hours
'https://isoline.router.hereapi.com/v8/isolines?transportMode=car&origin=52.51578,13.37749&range[type]=distance&range[values]=43200&routingMode=fast'
In .parse_response(i, out$responses()[[i]]) :
https://isoline.router.hereapi.com/v8/isolines: Request 'id = 1' failed.
Status 400; Bad Request; Bad request syntax or unsupported method.
Is there a max time you can use on the API?
Thanks!
The maximum value for the time is 9 hours.
I am using Python to download some data from bloomberg. It works most of the time, but sometimes it pops up a 'Time Out Issue`. And after that the response and request does not match anymore.
The code I use in the for loop is as follows:
result_IVM=con.bdh(option_name,'IVOL_MID',date_string,date_string,longdata=True)
volatility=result_IVM['value'].values[0]
When I set up the connection, I used following code:
con = pdblp.BCon(debug=True, port=8194, timeout=5000)
If I increase the timeout parameter (now is 5,000), will it help for this issue?
I'd suggest to increase the timeout to 5000 or even 10000 then test for few times. The default value of timeout is 500 milliseconds, which is small!
The TIMEOUT Event is triggered by the blpapi when no Event(s) arrives within milliseconds
The author of pdblp defines timeout as:
timeout: int Number of milliseconds before timeout occurs when
parsing response. See blp.Session.nextEvent() for more information.
Ref: https://github.com/matthewgilbert/pdblp/blob/master/pdblp/pdblp.py
Currently my code increases the delay between each retry : 0s, 2s, 4s, 8s, 16s... but I would like to retry a failed request every 30 seconds (even after the first fail).
It seems simple, but I can't find a way to do this with requests.packages.urllib3.util.retry
import requests
from requests.packages.urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
url = "http://192.168.1.10/last_data.json"
s = requests.Session()
retries = Retry(total=15,
backoff_factor=1,
status_forcelist=[ 500, 502, 503, 504 ])
s.mount('http://', HTTPAdapter(max_retries=retries))
response = s.get(url)
I know I can use time.sleep(30), but this isn't good practice.
Current wrk configuration allows sending continuous requests for seconds (duration parameter).
Is there a way to use wrk to send requests and then exit.
My use case: I want to create large number of threads + connections (e.g. 1000 threads with 100 connections per thread) and send instantaneous bursts towards the server.
You can do it with LUA script:
local counter = 1
function response()
if counter == 100 then
wrk.thread:stop()
end
counter = counter + 1
end
Pass this script with -s command line parameter.
I make changes to wrk to introduce new knobs. Let me know if anyone is interested in the patch and I could post it.
I added a -r to send exactly requests and bail out.
Artem,
I have this code-change in my fork:
https://github.com/bhakta0007/wrk
Is it possible to ignore the MAX_VALUE of 600 sec at Qt-testing?
I try:
qputenv("QTEST_FUNCTION_TIMEOUT", "1000000"); // 1'000 sec
but the result is:
System.Exception: Process timed out: 600s
So it is possible to increase the timeout from 300s to 600s.
The problem is, I need in one case 800 sec, how can I realize that?
Setting timeout to Qt Test