import requests #導入requests模塊
url = r'http://www.iplaypy.com/web/' # 把網址改為你要登陸的url即可
user = {'username':'liuaaaaaa','password':'liuaaaaaa'}
proxie = {
'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0",
}
s = requests.Session()
s.post(url,data = user,headers= proxie)
new_url = "http://www.iplaypy.com/web/" # 把網址改為你要登陸的url即可
r=s.post(new_url,params={'fun':'sign'},headers=proxie)
print r.text
print r.url
#一共post兩次,第一次post 為了過登陸,第二次post 為了簽到 proxie 注意是字典,中間不要用,分隔,分隔符是:
proxie 不是代理 ,就是一個存放字典的變量
閱讀更多 Python樂園 的文章