sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.89k stars 2.2k forks source link

APIError(code=0): Invalid JSON error message from Binance #1348

Open tugrandemirel opened 11 months ago

tugrandemirel commented 11 months ago

The code I wrote was working until a few days ago. But it's not working right now. My mistake was in October. I haven't figured out how to solve this. Can you help me? Thanks in advance.

["<class 'Exception'>","brsBot.py","878","APIError(code=0): Invalid JSON error message from Binance: <!DOCTYPE html>\n\n\n\n\n <meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\">\n\n <meta name=\"format-detection\" content=\"telephone=no,email=no,address=no\">\n Binance<\/title>\n <link rel=\"Shortcut Icon\" href=\"https:\/\/www.binance.com\/en\/favicon.ico\">\n <style>\n body {\n margin: 0\n }\n\n .img {\n width: 611px;\n margin: 68px auto 0\n }\n\n .info {\n width: 370px;\n margin: 0 auto;\n text-align: center;\n font-family: Arial;\n }\n\n .info h3 {\n margin: 0;\n font-size: 25px;\n color: #333;\n font-weight: normal;\n }\n\n .info p {\n font-size: 14px;\n font-family: Arial;\n color: #333;\n line-height: 18px;\n margin: 0\n }\n\n .info button {\n margin-top: 20px;\n width: 231px;\n height: 34px;\n background: #FFFFFF;\n border: 1px solid #F0B90B;\n box-sizing: border-box;\n border-radius: 3px;\n font-size: 14px;\n line-height: 16px;\n color: #F0B90B;\n }\n <\/style>\n<\/head>\n\n<body>\n <div class=\"img\"><img alt=\"\" src=\"\/errorPages\/404.jpg\"><\/div>\n <div class=\"info\">\n <h3>\u00e5\u0087\u00ba\u00e9\u0094\u0099\u00e5\u0095\u00a6\u00ef\u00bc\u0081\u00e6\u0082\u00a8\u00e8\u00ae\u00bf\u00e9\u0097\u00ae\u00e7\u009a\u0084\u00e7\u00bd\u0091\u00e9\u00a1\u00b5\u00e4\u00b8\u008d\u00e5\u00ad\u0098\u00e5\u009c\u00a8\u00e3\u0080\u0082<\/h3>\n <p>Sorry! The page you\u00e2\u0080\u0099re looking for cannot be found.<\/p>\n <a href=\"https:\/\/www.binance.com\">\n <button>Return to Binance home page<\/button>\n <\/a>\n <\/div>\n\n<\/body>\n\n<\/html>"]</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/PJV0043"><img src="https://avatars.githubusercontent.com/u/108961505?v=4" />PJV0043</a> commented <strong> 9 months ago</strong> </div> <div class="markdown-body"> <p>From the provided error message, it looks like the Binance API call you're making is returning a 404 error page, which means the endpoint or resource you're trying to access could not be found. Here are the steps to troubleshoot and potentially solve the issue:</p> <p>Check the Endpoint URL: Ensure that the endpoint you're accessing is still valid. Binance may change their API endpoints or require newer versions. Sometimes, small changes like an added or removed trailing slash can make a difference.</p> <p>Rate Limits: Binance imposes rate limits on its API. If you're making requests too frequently, you might get rate-limited or temporarily banned, which could result in such error pages. Ensure your code respects the rate limits mentioned in the Binance API documentation.</p> <p>User Agent: Some APIs can be sensitive to the User-Agent header sent with the request. If you're using a custom user agent or none at all, try using a common one like that of a popular browser or the default from a well-known HTTP library.</p> <p>API Version: Binance has different versions of its API (e.g., v1, v2, v3). Ensure you're using the correct and latest version of the API endpoint.</p> <p>Check Binance's Documentation: Periodically review <a href="https://binance-docs.github.io/apidocs/spot/en/">Binance's official API documentation</a> to make sure you're still using the correct endpoints and methods.</p> <p>Logging: Add more detailed logging to your script. This can help you identify the exact endpoint that's causing the error and the data being sent in the request.</p> <p>Network Issues: Ensure that your network connection is stable and that you aren't facing any issues connecting to Binance's servers.</p> <p>Maintenance or Downtime: Sometimes, exchanges undergo maintenance, which could temporarily make certain endpoints or services unavailable. It's always a good idea to check Binance's official channels or website for any maintenance or downtime announcements.</p> <p>Check for Library Updates: If you're using a third-party library to interact with Binance's API, make sure you're using its latest version. Libraries get updated to adapt to changes in the API.</p> <p>API Key Permissions: Ensure your API key has the necessary permissions to access user data streams and that it's not restricted or banned.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>