2
I’m having a problem that when I perform requests.get
diverse sometimes python starts to take A LONG time to get the request
.
I already thought it may be the API itself refusing my access, because it would be doing more than allowed, but according to this link I was able to say that this was not the problem. (But since I really have no idea what’s going on, I got in touch and they told me that this is really the limit of requests, that the site is correct.)
And this problem has happened to me before with another link, so I don’t know why this problem is happening.
What my system does would be something similar to:
import requests
import time
While True:
requests.get("https://brasilbitcoin.com.br/API/orderbook/XRP")
'''
trato o requests.get
'''
time.sleep(1)
I’ve confirmed that the problem is requests
and not any other part of the code.
Previously there was the time.sleep(1)
but I ended up adding it through doubts.
When I say I make a lot of requests, I’m talking about one per second for 24 hours a day. But after a while the requisition started to get EXTREMELY slow. When I restart the server to see if this is the problem, it returns to make the requests very well, but when it arrives around 200 requests it starts to take too long again.
(Right now it is taking ~44 seconds PER request on this link, and the trend is being this time increasing more and more).
Can anyone tell me what might be going on?
I’m using Windows and Python 3.8.2
It really needs to be done in this short period of time, including, it needs to be done so much that their own server authorizes only 1 request per second (which is what I do)... Because 4 seconds is already extremely long time for an intensive market analysis :(
– user3602803
So, answering another part of your "question", I believe it is not the problem that the server is penalizing me, because of what is documented in the api ..
– user3602803
@user3602803: The API documentation also talks about an "authentication key". The problem happens when this key is sent in the request header ?
– Lacobus
All their Apis are together on this site, this reference on the "Authentication Key" is for operations that depend on my user account and my API_KEY, for example, check balances, perform operations, among others, If you repair, you can access their REST from your own browser without any headers
– user3602803
@user3602803 if it is not the API (check the parameter
wait
that they mention in the documentation), it may be something that you do in the part that did not show the code, and that is overloading your server. For example, creating threads.– bfavaretto
Good! I’ll check it out and let you know
– user3602803
@Lacobus Unsuccessful.. Still slow
– user3602803