So basically I have an active Django project where in a module I am uploading images to the Imgur server and retrieving them as a background image for generating a PDF using the direct link for the images (https://i.imgur.com/.png)
The issue is that when trying to retrieve any image from the django server which is running on the local network IP (since the Imgur server blocks localhost) the server responds with a bizzare 429 error code.
The bizzare thing is I can upload images to my application without any problem, and also access the direct image links from postman API / browser, but as soon as I try to read the image direct link from my Django server imgur responds with a status code of 429.
Rate Limit data for my application:
Код: Выделить всё
{ "data": { "UserLimit": 500, "UserRemaining": 499, "UserReset": 1709980963, "ClientLimit": 12500, "ClientRemaining": 12495 }, "success": true, "status": 200 }
Код: Выделить всё
import requests id = '' res = requests.get(f'https://i.imgur.com/{id}.png') # print(res.json()) #! Throws JSONDecodeError print({ "Headers": res.headers, "status_code": res.status_code, "reason": res.reason, "content": res.text, "url": res.url, })
Код: Выделить всё
res.json()
Код: Выделить всё
{ "Headers": { "Connection": "close", "Content-Length": "0", "Retry-After": "0", "Cache-Control": "no-store, no-cache, must-revalidate, post-check=0, pre-check=0", "Accept-Ranges": "bytes", "Date": "Sat, 09 Mar 2024 10:10:15 GMT", "X-Served-By": "cache-ams21065-AMS", "X-Cache": "MISS", "X-Cache-Hits": "0", "X-Timer": "S1709979016.797421,VS0,VE0", "Strict-Transport-Security": "max-age=300", "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Origin": "*", "Server": "cat factory 1.0" } "status_code": 429 "reason": "Unknown Error" "content": "" "url": "https://i.imgur.com/\.png" "_content_consumed": true "is_permanent_redirect": false "is_redirect": false }
Источник: https://stackoverflow.com/questions/781 ... pplication