1
0
Fork 0

Use requests.Session.

This commit is contained in:
voussoir 2020-11-09 08:34:11 +01:00
parent 1c3fa864e9
commit 8a2e72b5cf

View file

@ -67,6 +67,9 @@ def int_or_none(x):
# API ##############################################################################################
session = requests.Session()
session.headers.update(HEADERS)
def get(url, retries=1):
start_time = time.time()
@ -74,7 +77,7 @@ def get(url, retries=1):
while retries > 0:
log.loud(url)
try:
response = requests.get(url, headers=HEADERS, timeout=2)
response = session.get(url, timeout=2)
response.raise_for_status()
break
except requests.exceptions.HTTPError as exc: