Request failed in Django but succeeds when I run script standalone

I have a script to get Steam inventory items and I want to use it in Django but when I use it in view or even I want to call the function with custom command in Django like this: python manage.py test_inventory I get 429 status code from Steam.
But when I run this script standalone and not in Django, it will be okay with status code 200 and it will return the items.

My function:

import requests

r = requests.get(
    "https://steamcommunity.com/inventory/76561198841800602/730/2/",
    params={
        "l": "english",
        "count": 2000,
    },
    timeout=30,
)

print(r.status_code)

Function is the same but I have error in Django.

Вернуться на верх