python3 post 提交输出结果 “true”是怎么回事
大家讲道理
大家讲道理 2017-04-18 09:07:46
0
1
255

1、途虎数据怎么爬取,弄了半天没有弄懂

2、网址:http://by.tuhu.cn/baoyang/Index.html?pid=VE-GM-S07BT&n=2013&pl=1.5L

3、这个是我的url

4、这个是我的表单

5、代码

import urllib.request
import urllib.parse

url = "http://by.tuhu.cn/baoyang/RecordUserOperation.html"
user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36'
values ={'operationDescription':'scpan','isBaoYangType':'true','isCheckedBaoYangService':'true'}

headers = {'User-Agent':user_agent}
data = urllib.parse.urlencode(values).encode(encoding='UTF8')
req = urllib.request.Request(url,data,headers)
response = urllib.request.urlopen(req)
the_page = response.read()

print(the_page.decode("utf8"))
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回覆(1)
迷茫

是不是因為頁404?

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!