use requests session
This commit is contained in:
parent
23a641189c
commit
e78519998d
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue