mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
News download: Support https proxies
This commit is contained in:
parent
48641b7c6c
commit
ddd8679c9d
@ -353,9 +353,14 @@ def browser(honor_time=True, max_time=2, mobile_browser=False, user_agent=None):
|
|||||||
if user_agent is None:
|
if user_agent is None:
|
||||||
user_agent = USER_AGENT_MOBILE if mobile_browser else USER_AGENT
|
user_agent = USER_AGENT_MOBILE if mobile_browser else USER_AGENT
|
||||||
opener.addheaders = [('User-agent', user_agent)]
|
opener.addheaders = [('User-agent', user_agent)]
|
||||||
http_proxy = get_proxies().get('http', None)
|
proxies = get_proxies()
|
||||||
|
http_proxy = proxies.get('http', None)
|
||||||
if http_proxy:
|
if http_proxy:
|
||||||
opener.set_proxies({'http':http_proxy})
|
opener.set_proxies({'http':http_proxy})
|
||||||
|
https_proxy = proxies.get('https', None)
|
||||||
|
if https_proxy:
|
||||||
|
opener.set_proxies({'https':https_proxy})
|
||||||
|
|
||||||
return opener
|
return opener
|
||||||
|
|
||||||
def fit_image(width, height, pwidth, pheight):
|
def fit_image(width, height, pwidth, pheight):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user