I want to get a steam user's CSGO inventory with this steam API and it works fine for the first 5-6 call. After that I get the error code 429, but I don't understand how I exceed the rate limit with this low amount of requests. I found this on steam: "You are limited to one hundred thousand (100,000) calls to the Steam Web API per day.", but I clearly did not make more than 100.000 calls.
import requests
import json
steamIDs = [
76561198323251063, # Enyém
76561199013264816 # Rolié
]
gameID = "730"
def jprint(obj):
text = json.dumps(obj, sort_keys=True, indent=4)
return text
response = requests.get(f"http://steamcommunity.com/inventory/{steamIDs[1]}/{gameID}/2")
print(response.status_code)
with open("data.txt", "w") as f:
f.write(jprint(response.json()))
The documented API rate limits have nothing to do with the request you're making, since this endpoint isn't part of Steam's official API. You can tell this since you don't need to use your API key in the request.
There are multiple endpoints available for fetching a user's inventory, but these endpoints became HEAVILY restricted in late November 2022. Adding a count
parameter to the request and limiting it to a value of 2000 may yield fewer 429 responses, but will make fetching inventories larger than 2000 items require two requests.