aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2026-04-27 19:31:47 +0100
committerAlex Schofield <git@ajschof.me>2026-04-27 19:31:47 +0100
commitc23d6575e9a020681a11079f8af4aae397398d17 (patch)
tree3d61ada276fa177a1a32853ea534f8e24966d857
parent4e0035ea359a22d1d395ae731c0ae3aa2ec921a3 (diff)
downloadfuelnearme-c23d6575e9a020681a11079f8af4aae397398d17.tar.gz
fuelnearme-c23d6575e9a020681a11079f8af4aae397398d17.zip
add user-agent header to request in get_latest_data()
-rw-r--r--main.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.py b/main.py
index d601c6b..88bb81f 100644
--- a/main.py
+++ b/main.py
@@ -20,6 +20,10 @@ SORT_KV = {
"distance": "distance",
}
+HEADERS = {
+ "User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.45 (KHTML, like Gecko) Chrome/48.0.2094.221 Safari/602"
+}
+
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
@@ -40,7 +44,7 @@ def get_location(address: str) -> tuple[float, float]:
def get_latest_data() -> Tuple[pd.DataFrame, str]:
try:
- response = requests.get(ENDPOINT)
+ response = requests.get(ENDPOINT, headers=HEADERS, timeout=10)
response.raise_for_status()
except Exception as e:
raise e
git.ajschof.me — hosted by ajschofield — powered by cgit