Add headers

This commit is contained in:
Midgard 2022-12-18 22:15:36 +01:00
parent 8fde521876
commit a4ec1acdf0
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -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)