Python 自动登录enoctus为自动下单做准备

  • Python 自动登录enoctus为自动下单做准备已关闭评论
  • 237 views
  • A+
所属分类:python
#coding:utf-8
import urllib
import http.cookiejar

uname="用户名"
pword="密码"
url = "https://einstein.enoctus.co.uk/dologin.php"
postdata =urllib.parse.urlencode({
    'username': uname,
    'password': pword
}).encode('utf-8')
header = {
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding":"utf-8",
"Accept-Language":"zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
"Connection":"keep-alive",
"Host":"einstein.enoctus.co.uk",
"Referer":"https://einstein.enoctus.co.uk/clientarea.php",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0"
}
req = urllib.request.Request(url,postdata,header)
##print(urllib.request.urlopen(req).read().decode('utf-8'))

#自动记住cookie
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
r = opener.open(req)
print(r.read().decode('utf-8'))
  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin