phin05 / discord-rich-presence-plex

Displays your Plex status on Discord using Rich Presence
MIT License
279 stars 33 forks source link

imgur uploads not working #103

Open Lion115e opened 1 month ago

Lion115e commented 1 month ago

imgur uploads were working fine up until recently, but i just noticed that discord now just displays a placeholder icon and the program is showing this every time. tried making a new imgur application and putting in the new client ID but same result. not sure if this is an error on the program or on imgur's end so any info would be appreciated :) image

FortKnox1337 commented 1 month ago

Working fine over here.

Screenshot (2)

phin05 commented 2 weeks ago

Imgur uploads are working fine for me as well.

@Lion115e Can you check the console output using v2.11.0? I've added some debug logging for the Imgur upload request.

Lion115e commented 23 hours ago

hi @phin05 i get this now

[03-11-2024 06:32:44 PM] [DEBUG] [SERVER_NAME] Uploading image to Imgur
[03-11-2024 06:32:44 PM] [DEBUG] HTTP 503, {'Connection': 'close', 'Content-Length': '442', 'Retry-After': '0', 'Content-Type': 'text/html; charset=utf-8', 'Accept-Ranges': 'bytes', 'Date': 'Sun, 03 Nov 2024 18:32:44 GMT', 'X-Served-By': 'cache-lon420130-LON', 'X-Cache': 'MISS', 'X-Cache-Hits': '0', 'X-Timer': 'S1730658764.444678,VS0,VE334', 'access-control-allow-methods': 'GET, PUT, POST, PATCH, DELETE, OPTIONS', 'Server': 'cat factory 1.0', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'X-Frame-Options': 'DENY', 'Access-Control-Allow-Headers': 'Authorization, Content-Type, Accept, X-Mashape-Authorization, IMGURPLATFORM, IMGURUIDJAFO, sessionCount, IMGURMWBETA, IMGURMWBETAOPTIN, X-expSNKPK127, X-Imgur-Defender-Bypass'}, <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>503 client read error</title>
  </head>
  <body>
    <h1>Error 503 client read error</h1>
    <p>client read error</p>
    <h3>Error 54113</h3>
    <p>Details: cache-lon420130-LON 1730658765 259973383</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>
[03-11-2024 06:32:44 PM] [ERROR] An unexpected error occured while uploading an image to Imgur
Traceback (most recent call last):
  File "C:\Users\USER_NAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER_NAME\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER_NAME\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER_NAME\AppData\Local\Programs\Python\Python312\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 "C:\Programs\discord-rich-presence-plex-v2.11.0\discord-rich-presence-plex\core\imgur.py", line 26, in uploadToImgur
    data: models.imgur.UploadResponse = response.json()
                                        ^^^^^^^^^^^^^^^
  File "C:\Users\USER_NAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
[03-11-2024 06:41:32 PM] [DEBUG] [SERVER_NAME] Uploading image to Imgur
[03-11-2024 06:41:32 PM] [DEBUG] HTTP 429, {'Connection': 'keep-alive', 'Content-Length': '142', 'content-encoding': 'gzip', 'content-type': 'application/vnd.imgur.v1+json', 'imgur-media-type': 'imgur.v1; param=full; format=json', 'x-post-rate-limit-limit': '1250', 'x-post-rate-limit-remaining': '1225', 'x-post-rate-limit-reset': '2654', 'x-ratelimit-clientlimit': '12500', 'x-ratelimit-clientremaining': '12499', 'x-ratelimit-clientreset': '86400', 'x-ratelimit-userlimit': '500', 'x-ratelimit-userremaining': '0', 'x-ratelimit-userreset': '3600', 'Accept-Ranges': 'bytes', 'Date': 'Sun, 03 Nov 2024 18:41:32 GMT', 'X-Served-By': 'cache-lon4229-LON', 'X-Cache': 'MISS', 'X-Cache-Hits': '0', 'X-Timer': 'S1730659292.391384,VS0,VE342', 'access-control-allow-methods': 'GET, PUT, POST, PATCH, DELETE, OPTIONS', 'Server': 'cat factory 1.0', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'X-Frame-Options': 'DENY', 'Access-Control-Allow-Headers': 'Authorization, Content-Type, Accept, X-Mashape-Authorization, IMGURPLATFORM, IMGURUIDJAFO, sessionCount, IMGURMWBETA, IMGURMWBETAOPTIN, X-expSNKPK127, X-Imgur-Defender-Bypass'}, {"errors":[{"id":"legacy-api-fbf8d4495-fg58v/XpGRYbsZu2-7552571","code":"429","status":"Too Many Requests","detail":"Too Many Requests"}]}
[03-11-2024 06:41:32 PM] [ERROR] An unexpected error occured while uploading an image to Imgur
Traceback (most recent call last):
  File "C:\Programs\discord-rich-presence-plex-v2.11.0\discord-rich-presence-plex\core\imgur.py", line 27, in uploadToImgur
    if not data["success"]:
           ~~~~^^^^^^^^^^^
KeyError: 'success'