Rate limits
One account can make 300 requests a minute. The count starts over at the top of each minute.
Past the limit the answer is 429, and nothing is done.
HTTP/1.1 429 Too Many Requests
Retry-After: 60Retry-After is in seconds, and it is the longest you may have to wait: the count can start over sooner.
import time
import requests
def get(url, headers):
while True:
response = requests.get(url, headers=headers)
if response.status_code != 429:
return response
time.sleep(int(response.headers["Retry-After"]))Staying under the limit
- List up to 100 items in one request to List items for sale instead of one at a time.
- Read your deals and your sales once a minute at most: deals move on Steam's time.
- An inventory upload has a pace of its own: within 30 seconds of the last one, the answer is the copy already there.