Add headers
This commit is contained in:
parent
8fde521876
commit
a4ec1acdf0
1 changed files with 7 additions and 1 deletions
|
@ -38,10 +38,16 @@ assert "elements" in data
|
||||||
notfound = []
|
notfound = []
|
||||||
redirects = []
|
redirects = []
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Accept-Encoding": "gzip,deflate",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"User-Agent": "osm_wikidata_check"
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print(" Wikidata ID | Redirect/issue | Label")
|
print(" Wikidata ID | Redirect/issue | Label")
|
||||||
for wd_id in ids(data["elements"]):
|
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:
|
if not r.ok:
|
||||||
print(f"{wd_id:>15} | NOT FOUND! |\t")
|
print(f"{wd_id:>15} | NOT FOUND! |\t")
|
||||||
notfound.append(wd_id)
|
notfound.append(wd_id)
|
||||||
|
|
Loading…
Reference in a new issue