diff options
| author | Alex Schofield <git@ajschof.me> | 2026-04-27 19:31:47 +0100 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2026-04-27 19:31:47 +0100 |
| commit | c23d6575e9a020681a11079f8af4aae397398d17 (patch) | |
| tree | 3d61ada276fa177a1a32853ea534f8e24966d857 | |
| parent | 4e0035ea359a22d1d395ae731c0ae3aa2ec921a3 (diff) | |
| download | fuelnearme-c23d6575e9a020681a11079f8af4aae397398d17.tar.gz fuelnearme-c23d6575e9a020681a11079f8af4aae397398d17.zip | |
add user-agent header to request in get_latest_data()
| -rw-r--r-- | main.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |
