Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is 'requests.exceptions.HTTPError: 451 Client Error'??? (binance) #15872

Closed
zacra opened this issue Nov 29, 2022 · 8 comments
Closed

What is 'requests.exceptions.HTTPError: 451 Client Error'??? (binance) #15872

zacra opened this issue Nov 29, 2022 · 8 comments

Comments

@zacra
Copy link

zacra commented Nov 29, 2022

Hello.
I am operating a class that allows automatic sales through Python by communicating with CCXT through AWS server.


Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 613, in fetch
    response.raise_for_status()
  File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 451 Client Error:  for url: https://fapi.binance.com/fapi/v1/exchangeInfo

However, some students suddenly encounter the above error and cannot call the API.

Was it blocked due to excessive API calls? Or is there another problem?
Please give me feedback on when such a message comes.

@zacra zacra changed the title What is 'requests.exceptions.HTTPError: 451 Client Error'??? What is 'requests.exceptions.HTTPError: 451 Client Error'??? (binance) Nov 29, 2022
@rogershihtw
Copy link

I also have the same problem when running auto trade in Binance Futures. The error appeared in the Google Cloud Functions. However, the ccxt seems to run well when I test it in my local debug environment(my notebook).

I guess it must be something wrong with BinanceAPI or they are changing policies toward API management.

@yjseok
Copy link

yjseok commented Nov 29, 2022

I also got same problem nowadays like below.

HTTPError: 451 Client Error:  for url: https://fapi.binance.com/fapi/v1/exchangeInfo
ExchangeError: binance GET https://fapi.binance.com/fapi/v1/exchangeInfo

I'm testing on Colab and running on GCP linux server.
I already tried to check and upgrade version of ccxt and pyopenssl.

Keep me this post to get information to solve this problem.

@singhyun90
Copy link

Try running the code in an environment other than the US.
It looks like Binance has blocked the US API.

Link : https://www.binance.com/en/terms
--> For the purposes hereof, “Restricted Location” shall include the United States, Malaysia, Ontario (Canada), and such other locations as designated by Binance Operators from time to time as a “Restricted Location” for the purposes hereof;

@gldstrrbt
Copy link

Try running the code in an environment other than the US. It looks like Binance has blocked the US API.

Link : https://www.binance.com/en/terms --> For the purposes hereof, “Restricted Location” shall include the United States, Malaysia, Ontario (Canada), and such other locations as designated by Binance Operators from time to time as a “Restricted Location” for the purposes hereof;

It makes sense they don't want to allow US customers, but to block their public api is a bit far. If anyone has a solution for client side workarounds other than connecting a device to a vpn/proxy, that'd be greatly appreciated. This is really screwing my project over.

gaugau3000 added a commit to gaugau3000/freqtrade that referenced this issue Nov 30, 2022
Inform end user before he creates server in a binance restricted location
ccxt/ccxt#15872
@xmatthias
Copy link
Contributor

It's quite an interesting behavior - we see similar behavior in CI (github actions runs on US Azure servers), however limited by time - seemingly to US "out of business" hours.

CI with active calls is passing fine during the european afternoon / evening - but is failing overnight / mornings.
I doubt regulations will change depending on the hour of the day - so this is pretty strange behavior.

@adens123
Copy link

adens123 commented Dec 1, 2022

如果是使用GCP Functions,可以透過以下方式解決,我已經可以使用了。
https://github.com/AlvarDev/functions-static-ip
https://hackmd.io/@S00kkKo0QbqD2O5ZCJZuyA/HkmnWorvo

@frosty00
Copy link
Member

frosty00 commented Dec 1, 2022

yeah, also i recommend using http://ip-api.com/json to check your ip

@ttodua
Copy link
Member

ttodua commented Dec 23, 2022

see #15891

@ttodua ttodua closed this as completed Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants