search

Home  >  Q&A  >  body text

python3 post 提交输出结果 “true”是怎么回事

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

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

3、这个是我的url

4、这个是我的表单

5、代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

<code class="python">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"))</code>

大家讲道理大家讲道理2892 days ago311

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-18 09:09:46

    Is it because of page 404?

    reply
    0
  • Cancelreply