Skip to content

Commit

Permalink
Added a sleep to stop us getting rate limited by Open AQ (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
rstrange-scottlogic authored Jul 19, 2024
1 parent 40f8c03 commit 2b019b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions air-quality-backend/etl/src/in_situ/openaq_dao.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging
import os
import time
from datetime import datetime
from urllib.parse import urlencode

Expand Down Expand Up @@ -96,4 +97,5 @@ def fetch_in_situ_measurements(cities, date_from: datetime, date_to: datetime):
city, date_from, date_to, cache_location, session
)
in_situ_data_by_city[city["name"]] = {"measurements": results, "city": city}
time.sleep(1) # To stop us getting rate limited by Open AQ
return in_situ_data_by_city

0 comments on commit 2b019b4

Please sign in to comment.