Beta 11.2 Update
This commit is contained in:
@@ -36,20 +36,14 @@ def get_html(url,cookies = None):#网页请求核心
|
||||
while i < retry_count:
|
||||
try:
|
||||
if not str(config['proxy']['proxy']) == '':
|
||||
proxies = {
|
||||
"http": "http://" + str(config['proxy']['proxy']),
|
||||
"https": "https://" + str(config['proxy']['proxy'])
|
||||
}
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36'}
|
||||
proxies = {"http": "http://" + str(config['proxy']['proxy']),"https": "https://" + str(config['proxy']['proxy'])}
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36'}
|
||||
getweb = requests.get(str(url), headers=headers, timeout=int(config['proxy']['timeout']),proxies=proxies, cookies=cookies)
|
||||
getweb.encoding = 'utf-8'
|
||||
# print(getweb.text)
|
||||
return getweb.text
|
||||
else:
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||
getweb = requests.get(str(url), headers=headers,timeout=int(config['proxy']['timeout']), cookies=cookies)
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||
getweb = requests.get(str(url), headers=headers, timeout=int(config['proxy']['timeout']), cookies=cookies)
|
||||
getweb.encoding = 'utf-8'
|
||||
return getweb.text
|
||||
except requests.exceptions.RequestException:
|
||||
|
||||
Reference in New Issue
Block a user