[英]how to run python script to display webpage for auto login on one click
I have my python script which I guess is fine. 我有我的python脚本,我猜很好。 I want to keep the script on the desktop and upon one click I want the script to run and open a browser(IE or firefox or chrome) and perform the script ie to log-in to a website.
我希望将脚本保留在桌面上,并且一键单击即可运行并打开浏览器(IE,firefox或chrome)并执行脚本,即登录网站。
import urllib, urllib2, cookielib
username = 'xyzusername'
password = 'xyzpassword'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'userid' : username, 'pass' : password})
resp = opener.open('http://www.gmail.com')
resp.read()
print resp
How do I run the script? 如何运行脚本? Please help.
请帮忙。
Hmmmm, your script is logging into a web site, but it's not opening a browser. 嗯,您的脚本正在登录到网站,但未打开浏览器。
If you want to open a browser, you might be better off looking at Selenium : 如果要打开浏览器,最好查看Selenium :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.