Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ! -*- encoding:utf-8 -*-
- import requests
- import spynner
- # 要访问的目标页面
- targetUrl = "http://a.ottcn.com/"
- # 代理服务器
- proxyHost = "http-dyn.abuyun.com"
- proxyPort = "9020"
- # 代理隧道验证信息
- proxyUser = "H96VBW27V3BJ3U2D"
- proxyPass = "0A082845E84864F8"
- proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
- "host": proxyHost,
- "port": proxyPort,
- "user": proxyUser,
- "pass": proxyPass,
- }
- proxies = {
- "http": proxyMeta,
- "https": proxyMeta,
- }
- cnt = 0
- #s = requests.Session()
- browser = spynner.Browser()
- browser.set_proxy(proxyMeta)
- browser.show()
- while True:
- try:
- #resp = s.get(targetUrl, proxies=proxies)
- browser.load(targetUrl, 20)
- print browser.get_cookies
- #if resp.status_code == 200:
- #print resp.text
- print cnt
- except Exception as e:
- print e
- cnt += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement