吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1626|回复: 5
收起左侧

[求助] python爬取时post问题

[复制链接]
ciker_li 发表于 2021-1-22 21:04
本帖最后由 ciker_li 于 2021-1-22 21:29 编辑

我想爬取孩子的考试成绩,网址http://60.223.230.87:9090/LSXQ
在网页正常浏览时,点击登陆,post学号密码后,会得到一个SET-Cookie :LS_UserInfo=xyXqmvT2gYFgnQ45q/hdeTUJufNqTrWP
但我自己写的post,却得不到。
用Fiddler抓取post帧数据,构造的跟正常浏览的一模一样,但返回缺没有那个SET-Cokkie,请问是为什么??
这 是我 的代码:
[Python] 纯文本查看 复制代码
import requests

s = requests.Session()
url1 = "http://60.223.230.87:9090/LSXQ"
res1 = s.get(url = url1)
url2 = "http://60.223.230.87:9090/LSXQ/account/Logon"
data = {"name":"2021154032","pwd":"588266","ibg":"0"}
cookie = "ASP.NET_SessionId=" + res1.cookies['ASP.NET_SessionId']+";__tins__20061455=%7B%22sid%22%3A%201611315255917%2C%20%22vd%22%3A%204%2C%20%22expires%22%3A%201611317104026%7D; __51cke__=; __51laig__=4"
header={
    "Accept":"text/html, */*; q=0.01",
    "X-Requested-With":"XMLHttpRequest",
    "Accept-Language":"zh-CN,zh;q=0.9",
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    "Origin": "http://60.223.230.87:9090",
    "Referer": "http://60.223.230.87:9090/LSXQ/",
    "Cookie":cookie,
    "Connection":"keep-alive"
    }
res2 = s.post(url=url2,data=data,headers =header)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

闲月疏云 发表于 2021-1-22 21:14
密码不正确,无法复现问题。
 楼主| ciker_li 发表于 2021-1-22 21:29
muyan1995 发表于 2021-1-22 21:50
SET-Cookie 一般会在你首次get请求的response.headers 里面返回
hjy3721 发表于 2021-1-22 21:54
url2 = "http://60.223.230.87:9090/LSXQ/account/Logon"
Login?
rsnodame 发表于 2021-1-23 13:01
遇事不决 selenium
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-24 18:46

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表