DeltaNeverUsed / reddit-place-script-2022-Delta-s-Edition

Script to an image onto r/place (https://www.reddit.com/r/place/)
8 stars 3 forks source link

json decoder error #5

Open agent-guardian opened 2 years ago

agent-guardian commented 2 years ago

the json will have a decoding error after running the bots for long enough, and while handling that error another error occurs, killing the program.


  File "***\Python\Python38\lib\site-packages\requests\models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "***\Python\Python38\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "***\Python\Python38\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "***\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "***/reddit-place-script-2022-Delta-s-Edition/main.py", line 423, in <module>
    get_valid_auth(name)
  File "***/reddit-place-script-2022-Delta-s-Edition/main.py", line 209, in get_valid_auth
    response_data = r.json()
  File "***\Python\Python38\lib\site-packages\requests\models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value]
<!doctype html>
<html><head><title>Ow! -- reddit.com</title>
  <script type="text/javascript">
    // send metric to our internal tracker.
    function makeRequest(url, data) {
      var dataString;
      try {
        dataString = JSON.stringify(data);
      } catch (e) {
        return false;
      }
      if (window.XMLHttpRequest) {
        httpRequest = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        try {
          httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
          try {
            httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
          }
          catch (e) {}
        }
      }
      if (!httpRequest) {
      }
      httpRequest.open('POST', url);
      httpRequest.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
      httpRequest.send(dataString);
    }
    makeRequest('https://stats.redditmedia.com', {cdnError:{error50x:1,}});
  </script>
<style>
body{text-align:center;position:absolute;top:50%;margin:0;margin-top:-275px;width:100%}
h2,h3{color:#555;font:bold 200%/100px sans-serif;margin:0}
h3{color:#777;font:normal 150% sans-serif}
</style>
</head>
<img src=//redditstatic.s3.amazonaws.com/heavy-load.png alt="">
<h2>Our CDN was unable to reach our servers</h2>
Please check <a href="http://www.redditstatus.com/">www.redditstatus.com</a> if you consistently get this error.
: 1```
(censored for privacy)
DeltaNeverUsed commented 2 years ago

it looks like it failed to log in, and it just fails because of that, i could add a check so i just continues and skips that account