mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
timeout
This commit is contained in:
parent
6c1254b4b2
commit
09b53bebe9
@ -115,7 +115,13 @@ def updatemethod(urls, self):
|
|||||||
return savep
|
return savep
|
||||||
with open(savep, "wb") as file:
|
with open(savep, "wb") as file:
|
||||||
sess = requests.session()
|
sess = requests.session()
|
||||||
r = sess.get(url, stream=True, verify=False, proxies=getproxy(("update", __x)))
|
r = sess.get(
|
||||||
|
url,
|
||||||
|
stream=True,
|
||||||
|
verify=False,
|
||||||
|
proxies=getproxy(("update", __x)),
|
||||||
|
timeout=None,
|
||||||
|
)
|
||||||
file_size = 0
|
file_size = 0
|
||||||
for i in r.iter_content(chunk_size=1024):
|
for i in r.iter_content(chunk_size=1024):
|
||||||
if check_interrupt():
|
if check_interrupt():
|
||||||
|
@ -7,6 +7,8 @@ from myutils.config import globalconfig
|
|||||||
|
|
||||||
default_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
default_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
||||||
|
|
||||||
|
default_timeout = 10
|
||||||
|
|
||||||
|
|
||||||
class RequestException(Exception):
|
class RequestException(Exception):
|
||||||
pass
|
pass
|
||||||
@ -257,7 +259,7 @@ class Requester_common:
|
|||||||
cookies=None,
|
cookies=None,
|
||||||
files=None,
|
files=None,
|
||||||
auth=None,
|
auth=None,
|
||||||
timeout=None,
|
timeout=default_timeout,
|
||||||
allow_redirects=True,
|
allow_redirects=True,
|
||||||
hooks=None,
|
hooks=None,
|
||||||
stream=None,
|
stream=None,
|
||||||
@ -290,8 +292,6 @@ class Requester_common:
|
|||||||
headers["Content-Type"] = contenttype
|
headers["Content-Type"] = contenttype
|
||||||
proxy = proxies.get(scheme, None) if proxies else None
|
proxy = proxies.get(scheme, None) if proxies else None
|
||||||
proxy = None if proxy == "" else proxy
|
proxy = None if proxy == "" else proxy
|
||||||
if timeout is None:
|
|
||||||
timeout = 10
|
|
||||||
if timeout:
|
if timeout:
|
||||||
if isinstance(timeout, (float, int)):
|
if isinstance(timeout, (float, int)):
|
||||||
timeout = int(timeout * 1000) # convert to milliseconds
|
timeout = int(timeout * 1000) # convert to milliseconds
|
||||||
@ -470,7 +470,7 @@ class Session:
|
|||||||
cookies=None,
|
cookies=None,
|
||||||
files=None,
|
files=None,
|
||||||
auth=None,
|
auth=None,
|
||||||
timeout=None,
|
timeout=default_timeout,
|
||||||
allow_redirects=True,
|
allow_redirects=True,
|
||||||
hooks=None,
|
hooks=None,
|
||||||
stream=None,
|
stream=None,
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 50)
|
set(VERSION_MINOR 50)
|
||||||
set(VERSION_PATCH 0)
|
set(VERSION_PATCH 1)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user