如何在python中使用参数从GET方法的API获得响应?

时间:2013-07-25 06:03:17

标签: python-2.7 httprequest

有一个API **http://172.25.0.1/listVideo.psp?count=20** 这给了json的回应。

url = "http://172.25.0.1/getVideo.psp"
request = urllib2.Request(url)
headers = {"Content-Type":"application/json"}
for key,value in headers.items():
    request.add_header(key,value)            
response = urllib2.urlopen(request)
return response

那么如何添加参数?我尝试了一些代码但是失败了。所以请帮我添加参数 count = 20

0 个答案:

没有答案