感谢大佬指点,成功了:
起初我认为第一次访问的url是访问时用的链接是http://opene164.org.cn/mark/index.html
后来才发现原来中间这查询框是另一个链接 http://opene164.org.cn/mark/query/index.html
import requests
url = 'http://opene164.org.cn/mark/query/index.html'
header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40'}
session = requests.session()
res = session.get(url=url,headers=header)
img_url = 'http://opene164.org.cn/mark/query/captcha.html'
img = session.get(img_url,headers=header)
with open('img-1.gif','wb') as f:
f.write(img.content)
port_html ='http://opene164.org.cn/mark/data.do'
data={'phone':'07586543210'}
captcha_in = input('captcha_IN')
data['captcha'] = captcha_in
find = session.post(url=port_html,data=data,headers=header)
find.text
Out[5]: '{"data":"{\"msg\":\"您号码开户的运营商未接入平台,今日查询量已达到试用上限,请明日查询\",\"status\":500}","msg":"成功","status":200}'
|