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: 60

Retry-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