1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

add 'method' parameter

This commit is contained in:
Mike Fährmann 2014-10-31 23:38:21 +01:00
parent 7588974306
commit b630753e5e

View File

@ -2,12 +2,12 @@ import time
import requests
import html.parser
def safe_request(session, url, *args, **kwargs):
def safe_request(session, url, method="GET", *args, **kwargs):
tries = 0
while True:
# try to connect to remote source
try:
r = session.get(url, *args, **kwargs)
r = session.request(method, url, *args, **kwargs)
except requests.exceptions.ConnectionError:
tries += 1
time.sleep(1)