[問題] 該怎麼用python登入自己寫的表單?
大家好
新手在下 寫了一個測試網頁 位在 http://pure.comxa.com/index.html
帳號是 test@test.com 密碼是 test
登入成功 會顯示 you did it 登入失敗 會跳js窗 說error
現在 想用python 3 練習登入
然而 每次都會傳回登入錯誤的頁面 不知道錯在哪
實在是很困惑
不知是否有高手能救救我呢???? >< 謝謝各位
程式碼如下
import requests
import urllib
from requests import session
headers = {'User-Agent': 'Mozilla/5.0'}
payload = {
'action': 'loginSuccessDisplay.php',
'userName':'test@test.com',
'pswd':'test'
}
with session() as c:
c.post('http://pure.comxa.com/index.html',headers=headers,data=payload)
response = c.get('http://pure.comxa.com/loginSuccessDisplay.php')
# 改成index.html還是不行 會返回登入頁面@@
print(response.headers)
print(response.text)
話說我的網頁後台並不會產生session
而是只是單純的驗證username pswd有沒有match
請問這是問題癥結點嗎?
還是我的 request 寫錯了呢? >< 懇請大大賜教謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.5.163
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1460476500.A.2CF.html
※ 編輯: phpjson (180.217.5.163), 04/13/2016 01:17:22
→
04/13 01:22, , 1F
04/13 01:22, 1F
→
04/13 01:23, , 2F
04/13 01:23, 2F
→
04/13 01:27, , 3F
04/13 01:27, 3F
→
04/13 01:28, , 4F
04/13 01:28, 4F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):