Python post 请求

Python post 请求

Luo Weifeng 2011-7-21


#!/usr/bin/python
import urllib,urllib2

url = 'http://www.commentcamarche.net/search/search.php3'
parameters = {'Mot' : 'Gimp'}

data = urllib.urlencode(parameters)    # Use urllib to encode the parameters
request = urllib2.Request(url, data)
response = urllib2.urlopen(request)    # This request is sent in HTTP POST
page = response.read(200000)


你可能感兴趣的:(python,url,Parameters)