Python HTTP请求,登录但不完整

时间:2017-04-18 14:20:19

标签: python http

import requests
import random

with requests.Session() as c:
    url = 'https://www.example.com/ajax/logon.php?t=login'
    USERNAME = 'login'
    PASSWORD = 'password'

    AGENT = {'User-Agent': 'Its me',}
    c.get(url)
    tokens = c.cookies
    login_data = (('l',USERNAME), ('ph' , PASSWORD)) 
    c.post(url, data = login_data, headers=AGENT)
url2 = 'http://second.example.com/engine'
go_data = (('t','init'), ('value' , str(random.random())), ('id' , '6959025'))
page = c.get(url2, params = go_data, headers=AGENT)
print(page.text)

我做的一切都好吗?因为它说我没有登录,所以在Wireshark中也没有POST请求。 我很肯定这篇文章正在发挥作用,因为它从我的帐户中注销了我。

0 个答案:

没有答案