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

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

Open
Beard81 opened this issue Jan 9, 2022 · 12 comments
Open

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

Beard81 opened this issue Jan 9, 2022 · 12 comments
Labels
bug Something isn't working

Comments

@Beard81
Copy link

Beard81 commented Jan 9, 2022

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!

@Beard81 Beard81 added the bug Something isn't working label Jan 9, 2022
@matbee-eth
Copy link

I'm having the same issue

@bombcherry
Copy link

I am also having this issue, on Mac OS

@Beard81
Copy link
Author

Beard81 commented Jan 10, 2022

I'm on Win 11...

@AussieTerror
Copy link

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

@matbee-eth
Copy link

Temporary fix: Line 44 of new_listings_scraper.py

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

@Beard81
Copy link
Author

Beard81 commented Jan 10, 2022

Working for me, thanks!

@vanekj
Copy link

vanekj commented Jan 10, 2022

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
Copy link
Collaborator

Linus045 commented Jan 10, 2022

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
Copy link
Collaborator

#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 Linus045 changed the title JSON Code Error JSON Code Error | Status code 429 Too many requests Jan 13, 2022
@Linus045
Copy link
Collaborator

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
Copy link

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 Linus045 changed the title JSON Code Error | Status code 429 Too many requests JSON Code Error 403 Forbidden | 429 Too many requests Jan 16, 2022
@Linus045 Linus045 changed the title JSON Code Error 403 Forbidden | 429 Too many requests JSON Code Error | 403 Forbidden | 429 Too many requests Jan 16, 2022
@Linus045
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants