API Rate Limits#

The NSRDB API docs mention that total and remaining request/rate limit information is included in the HTTP headers of the API response. This is not currently returned by pvlib’s get_psm3() (maybe it should be?), so here’s a quick way of accessing it yourself.

[1]:
import requests
api_key = 'DEMO_KEY'
response = requests.head('https://developer.nrel.gov/api/nsrdb/v2/solar/psm3-tmy-download.csv?api_key=' + api_key)
print(response.headers['X-Ratelimit-Remaining'], 'remaining of', response.headers['X-Ratelimit-Limit'])
10 remaining of 40
[2]:
%load_ext watermark
%watermark --iversions -u -d -t
Last updated: 2022-09-22 21:45:59

requests: 2.28.1

[ ]: