Skip to content

Commit

Permalink
re-instate the API rate limited (datacommonsorg#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
jehangiramjad authored Feb 21, 2024
1 parent ea79e45 commit 5ccb0fd
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 5ccb0fd

Please sign in to comment.