From 7021b6c416fceaf7540ecfb715b0931e13a681a8 Mon Sep 17 00:00:00 2001 From: Jehangir Amjad <1021616+jehangiramjad@users.noreply.github.com> Date: Thu, 22 Feb 2024 03:04:57 +0500 Subject: [PATCH] re-instate the API rate limited (#988) --- scripts/us_usda/quickstats/process.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/us_usda/quickstats/process.py b/scripts/us_usda/quickstats/process.py index e8312452ca..72f1902503 100644 --- a/scripts/us_usda/quickstats/process.py +++ b/scripts/us_usda/quickstats/process.py @@ -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' @@ -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()