mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
add 'method' parameter
This commit is contained in:
parent
7588974306
commit
b630753e5e
@ -2,12 +2,12 @@ import time
|
|||||||
import requests
|
import requests
|
||||||
import html.parser
|
import html.parser
|
||||||
|
|
||||||
def safe_request(session, url, *args, **kwargs):
|
def safe_request(session, url, method="GET", *args, **kwargs):
|
||||||
tries = 0
|
tries = 0
|
||||||
while True:
|
while True:
|
||||||
# try to connect to remote source
|
# try to connect to remote source
|
||||||
try:
|
try:
|
||||||
r = session.get(url, *args, **kwargs)
|
r = session.request(method, url, *args, **kwargs)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
tries += 1
|
tries += 1
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user