CyberPunkMetalHead / gateio-crypto-trading-bot-binance-announcements-new-coins

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
MIT License
1.21k stars 302 forks source link

JSON Code Error | 403 Forbidden | 429 Too many requests #137

Open Beard81 opened 2 years ago

Beard81 commented 2 years ago

Hey everyone,

I've been using this bot the past few days and it's been running fine. I'm not a coder and really just learning as I go. This morning I noticed that this line was repeating in the command prompt window:

Expecting value: line 1 column 1 (char 0)

I stopped the bot and restarted and this is what happens everytime;

C:\Users\user\Desktop\bot>python src/main.py 2022-01-09 15:05:24,983 INFO: Getting the list of supported currencies from gate io 2022-01-09 15:05:26,575 INFO: List of gate io currencies saved to currencies.json. Waiting 5 minutes before refreshing list... 2022-01-09 15:05:26,575 INFO: new-coin-bot online 2022-01-09 15:05:26,575 INFO: started working... Traceback (most recent call last): File "C:\Users\user\Desktop\bot\src\main.py", line 466, in main() File "C:\Users\user\Desktop\bot\src\main.py", line 425, in main latest_coin = get_last_coin() File "C:\Users\user\Desktop\bot\src\new_listings_scraper.py", line 92, in get_last_coin latest_announcement = get_announcement() File "C:\Users\user\Desktop\bot\src\new_listings_scraper.py", line 53, in get_announcement latest_announcement = latest_announcement.json() File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I tried to google this and understand what it's telling me, but i'm just too green. Hoping somebody on here can help sort this problem out. I've re-installed Python and re-downloaded the bot from github and set it up again. No change....

Thanks!

matbee-eth commented 2 years ago

I'm having the same issue

bombcherry commented 2 years ago

I am also having this issue, on Mac OS

Beard81 commented 2 years ago

I'm on Win 11...

AussieTerror commented 2 years ago

Getting the same, Is this an API response change with Binance?

matbee-eth commented 2 years ago

Temporary fix: Line 44 of new_listings_scraper.py

Make sure the URL is: https://www.binance.com not binancezh.com or whatever

Beard81 commented 2 years ago

Working for me, thanks!

vanekj commented 2 years ago

Temporary fix: Line 44 of new_listings_scraper.py

Make sure the URL is: binance.com not binancezh.com or whatever

Confirmed also for me, thanks!

Linus045 commented 2 years ago

It seems as though Binance has changed their api and now returns a 403-Forbidden Error when trying to access www.binancezh.com . Changing the domain to binance.com fixes the issue. Though some people might experience higher response times with that.

We should first of all make sure that the bot doesn't crash when if can't reach the binance annoucement page.

A next step would be to implement some system to check a list of domains and compare their response time (ping) and the time it took for the annoucement to get listed and then use the best one (since this depens on the clients location). A possible way to retrieve other valid Binance Domains can be found in this Reddit Thread

I did some testing on my own fork see: https://github.com/Linus045/gateio-crypto-trading-bot-binance-announcements-new-coins/tree/feature_binance_domain_swapper

Linus045 commented 2 years ago

140 (develop branch) causes the bot to report an error to the console instead of crashing.

This is not the best solution but it fixes the crash for now and keeps the bot running.

Linus045 commented 2 years ago

Temporary fix: Line 44 of new_listings_scraper.py

Make sure the URL is: binance.com not binancezh.com or whatever

Regarding this, #144 got merged into develop as well, which will be released with the next merge with master.

matt1966 commented 2 years ago

Is anybody getting 405 responses? I get the following error on the page (when translating from Chinese)

405 response: Sorry, your access is blocked because the URL you are visiting may pose a security threat to the website If you are accessing normally, please contact the business system administrator to add white or other methods to deal with Your request id is: xxx

Linus045 commented 2 years ago

Is anybody getting 405 responses? I get the following error on the page (when translating from Chinese)

405 response: Sorry, your access is blocked because the URL you are visiting may pose a security threat to the website If you are accessing normally, please contact the business system administrator to add white or other methods to deal with Your request id is: xxx

You can try to switch the network or use some kind of VPN. If that still doesn't help feel free to create a new Issue.