Skip to content

Commit

Permalink
re-instate the API rate limited (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
jehangiramjad authored Feb 21, 2024
1 parent a4a9c3c commit 7021b6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/us_usda/quickstats/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from absl import app
from absl import flags
from google.cloud import storage
from ratelimit import limits
from ratelimit import limits, sleep_and_retry
import requests

API_BASE = 'https://quickstats.nass.usda.gov/api'
Expand Down Expand Up @@ -203,8 +203,8 @@ def get_survey_county_data(year, county, out_dir, usda_api_key):
return response


# TODO: determine if the rate limiter needs to be re-enabled.
# @limits(calls=10, period=60)
@sleep_and_retry
@limits(calls=10, period=60)
def get_data(params):
return requests.get(f'{API_BASE}/api_GET', params=params).json()

Expand Down

0 comments on commit 7021b6c

Please sign in to comment.