Commit 02b82e44 by lichenggang

add proxy

parent 44fc82f9
Showing with 19 additions and 1 deletions
......@@ -16,8 +16,26 @@ headers = {
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
}
#http代理接入服务器地址端口
proxyHost = "http-proxy-t3.dobel.cn"
proxyPort = "9180"
resp = a.requests.session().get(url, headers=headers).text
#账号密码
proxyUser = "LIEXINHTT1"
proxyPass = "oK97IIl298"
proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
"host" : proxyHost,
"port" : proxyPort,
"user" : proxyUser,
"pass" : proxyPass,
}
proxies = {
"http" : proxyMeta,
"https" : proxyMeta,
}
resp = a.requests.get(url, headers=headers,proxies=proxies).text
doms = a.etree.HTML(resp)
cate_pagecount_pattern = a.re.compile('')
content_sections = doms.xpath('//div[@class="categoryContainer"]//section')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment