I have this issue opened in one of my repos: fj317/PumpBot#36.
I've tried looking through all the API documentation and have had no luck in finding a way to set the full API URL, only the TLD. According to this there should be 3 additional API URLs that can be connected to.
Is it possible to set the entire URL to change the API server queried?
I could be wrong but have you looked in ./dist-packages/binance/websockets.py?
So I am using the US version of Binance, I have to change the 'STREAM_URL' and 'FSTREAM_URL' to the '.us' version in websockets.py. Then in client.py in the __init__ constructor I changed tdl='com' to tdl='us'. This fixed my connection issue I have been having. I don't know if this is what you are asking but I hope it helps!
Changing the tdl for the client constructor is what is confusing me.
I believe I want to change the entire web URL, not the ending tdl which I'm not sure if the code allows.
The exact lines from client.py is:
API_URL = 'https://api.binance.{}/api'
...
self.API_URL = self.API_URL.format(tld)
Which makes me feel that what I'm attempting isn't possible.
Why don't you just try changing the string to "https://api1.binance.{}/api"? If you are getting connection with the current one then the code is running correctly, in that case this should just change the server it points to. Let me know if this works!
I can't change the string because its part of the python-binance api which I don't control. The only change I can make is when I'm establishing the client link and there is no parameter which can change the whole string so I'm stuck :/
I am not sure if i understand correctly.
from binance.client import Client as BClient
BClient.API_URL = 'https://api2.binance.{}/api'
bclient = BClient(binance_api_key, binance_secret_key)
Most helpful comment
So I am using the US version of Binance, I have to change the 'STREAM_URL' and 'FSTREAM_URL' to the '.us' version in websockets.py. Then in client.py in the __init__ constructor I changed tdl='com' to tdl='us'. This fixed my connection issue I have been having. I don't know if this is what you are asking but I hope it helps!