mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 20:22:45 +01:00
Geography: Set a better user-agent to access Wikidata
This commit is contained in:
parent
27c513135c
commit
0a6f598295
@ -110,7 +110,12 @@ LIMIT 1
|
||||
def _query_sparql(query):
|
||||
params = {"format": "json", "query": query}
|
||||
url = SPARQL_URL + "?" + urllib.parse.urlencode(params)
|
||||
content = utils.web.getUrlContent(url)
|
||||
|
||||
# Comply with https://meta.wikimedia.org/wiki/User-Agent_policy
|
||||
headers = utils.web.defaultHeaders.copy()
|
||||
headers["User-agent"] += " https://github.com/progval/Limnoria/ - Geography plugin"
|
||||
|
||||
content = utils.web.getUrlContent(url, headers=headers)
|
||||
return json.loads(content)
|
||||
|
||||
def timezone_from_qid(location_qid):
|
||||
|
Loading…
Reference in New Issue
Block a user