From a4ec1acdf031adb0d9c8290ffaa8a09254952c28 Mon Sep 17 00:00:00 2001 From: Midgard Date: Sun, 18 Dec 2022 22:15:36 +0100 Subject: [PATCH] Add headers --- osm_wikidata_check.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osm_wikidata_check.py b/osm_wikidata_check.py index 4b0a5ed..064e3a6 100755 --- a/osm_wikidata_check.py +++ b/osm_wikidata_check.py @@ -38,10 +38,16 @@ assert "elements" in data notfound = [] redirects = [] +headers = { + "Accept-Encoding": "gzip,deflate", + "Accept": "application/json", + "User-Agent": "osm_wikidata_check" +} + try: print(" Wikidata ID | Redirect/issue | Label") for wd_id in ids(data["elements"]): - r = s.get(f"https://www.wikidata.org/entity/{wd_id}") + r = s.get(f"https://www.wikidata.org/entity/{wd_id}", headers=headers) if not r.ok: print(f"{wd_id:>15} | NOT FOUND! |\t") notfound.append(wd_id)