diff --git a/wikidata_ext.py b/wikidata_ext.py index 51a5fa4..3f0c26c 100644 --- a/wikidata_ext.py +++ b/wikidata_ext.py @@ -6,7 +6,7 @@ import requests import json import logging -REQUEST_SESSION = requests.Session() +REQUEST_SESSION = None # TODO? def concept_uri(obj): assert isinstance(obj, wikidata.entity.Entity), obj @@ -33,6 +33,7 @@ def fmt_triple_value(obj, prefer_obj = False): @ratelimit.sleep_and_retry def fetch_by_url(url, headers): logging.debug('Fetching: %s', url) + assert REQUEST_SESSION is not None, 'REQUEST_SESSION must be set, before calling fetch_by_url' response = REQUEST_SESSION.get(url, headers = headers) if response.status_code != 200: logging.error('Got %s error message: %s', response.status_code, response.text)