call = 0
start_time = datetime.now()
file1 = open("data.txt","r")
for line in file1.readlines():
    if (datetime.now() - start_time).total_seconds() > 1 or call >= 90:
        # time.sleep(60 - (datetime.now() - start_time).total_seconds() + 60)
        time.sleep(10)
        start_time = datetime.now()
    line = line.strip()
    all_data = f"api/{line}"
    headers = {
    'accept': 'application/json',
    'X-CSRFToken': 'csrftoken',
    'Authorization': 'AuthToken'
    }
    try:
        r = requests.get(all_data, headers=headers)
        trading = r.json()
    except Exception as e:
        print(f'error with {line}')
    end_time = datetime.now()
    if trading:
        with open('/folder/'+line+'.json', 'w') as file_object:
            json.dump(trading, file_object)
        print("done with",line)
    call += 1
we need save api response on json file.
I have handle api call in time limit but it gives still Request was throttled error. I have 11000 something endpoint data. Rate Limit is In additional to the limits associated with your pricing plan, there is a throttle of 100 calls per second and 1,000 calls per minute. Exceeding this rate limit will result in reponse errors until the limit resets.
json file error response :
{
    "detail": "Request was throttled. Expected available in 1319 seconds."
}
