diff --git a/ox/cache.py b/ox/cache.py index 904f31d..b5f9a9e 100644 --- a/ox/cache.py +++ b/ox/cache.py @@ -16,6 +16,7 @@ from six import PY2 try: import requests USE_REQUESTS = True + requests_session = requests.Session() except: USE_REQUESTS = False @@ -101,7 +102,7 @@ def read_url(url, data=None, headers=None, timeout=cache_timeout, valid=None, un url_headers = {} if not result: if USE_REQUESTS: - r = requests.get(url, headers=headers) + r = requests_session.get(url, headers=headers) for key in r.headers: url_headers[key.lower()] = r.headers[key] result = r.content