知乎上的个人详细页面post地址怎么找
我处理的时候出现以下内容的:
每次点击修改内容,都会出现ProfileHeaderV2这个链接信息,但访问是404的,
然后又提示post信息却又是这个地址,这是为咋的?
======================
补充代码
# /usr/bin/python#coding:utf-8
__author__ = 'eyu Fanne'
import requests,time
from bs4 import BeautifulSoup
begintime = time.time()
headers={
"Host":"www.zhihu.com",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36",
"Accept":"*/*",
"Accept-Language":"zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept-Encoding":"gzip, deflate",
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With":"XMLHttpRequest",
"Connection":"keep-alive"
}
login_url=r'https://www.zhihu.com/login/email'
html_txt = requests.get(login_url,verify=False).text
html_soup = BeautifulSoup(html_txt,'lxml')
xsrf = html_soup.find("input",{"name":"_xsrf"})['value']
#print xsrf
#print html_txt
s = requests.session()
url_data={
"_xsrf":xsrf,
"email":"*****",
"password":"*****",
'remember_me':'true'
}
s_login=s.post(login_url,data=url_data,headers=headers,verify=False)
print s_login.text
# endtime = time.time()
# usetime = endtime - begintime
# print "执行脚本总用时 %s 秒" % usetime
#print s.get('https://www.zhihu.com',verify=False).text
#修改个人简介
edit_url=r'https://www.zhihu.com/node/ProfileHeaderV2'
peplo_url=r'https://www.zhihu.com/people/shui-di-you/about'
edit_html_txt = s.get(peplo_url,verify=False).text
#print edit_html_txt.text
exit_html_soup = BeautifulSoup(edit_html_txt,'lxml')
edit_xsrf = exit_html_soup.find("input",{"name":"_xsrf"})['value']
print 'edit_xsrf:%s' %edit_xsrf
edit_url_data={
"_xsrf":edit_xsrf,
"method":"save",
"params":{"data":{"description":"233333~~~"}}
}
edit_header={
"Host":"www.zhihu.com",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36",
"Accept":"*/*",
"Accept-Language":"zh-CN,zh;q=0.8",
"Accept-Encoding":"gzip, deflate",
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With":"XMLHttpRequest",
"Connection":"keep-alive",
"Origin":"https://www.zhihu.com",
"Referer":"https://www.zhihu.com/people/shui-di-you/about"
}
s_edit=s.post(edit_url,data=edit_url_data,headers=edit_header,verify=False)
print s_edit
最后s_edit得到的结果是
{"r":0, "msg": "\u767b\u9646\u6210\u529f"
}
<Response [400]>
Process finished with exit code 0
搞定了,把参数params = json.dumps({"data":{"description":"233333~~~"}})
转一下json格式就好了
回答:
可能是Post数据的事吧,可能Post绑定方法了,Get的没绑定
回答:
你的请求的 Remote Address 为什么会是本地的 127.0.0.1:8888?
这个地址要带参数去访问才是正常的,不然服务器返回什么都是有可能的。
回答:
POST带的参数是什么,建议用Wireshark抓两个包,一个是知乎页面上修改时的POST包,另外是你用python POST的包,查看具体区别。
以上是 知乎上的个人详细页面post地址怎么找 的全部内容, 来源链接: utcz.com/a/160543.html