Python HTTP请求补丁

时间:2016-03-15 21:07:19

标签: python json urllib2 patch

我试图通过补丁向api发送信息:

url = "http://xyz"

data_json = "{'estampas': [{'estampa': u'52'}, {'estampa': u'63'}, {'estampa': u'74'}, {'estampa': u'85'}, {'estampa': u'93'}, {'estampa': u'94'}, {'estampa': u'95'}, {'estampa': u'96'}, {'estampa': u'97'}, {'estampa': u'53'}, {'estampa': u'54'}, {'estampa': u'55'}, {'estampa': u'56'}, {'estampa': u'57'}, {'estampa': u'58'}, {'estampa': u'11'}]}"

request = urllib2.Request(url, data=urllib.urlencode(data_json))
request.add_header("Content-Type", "application/json")
request.get_method = lambda: "PATCH"
response = urllib2.urlopen(request)
print response

为什么打印它?

<addinfourl at 140636007575424 whose fp = <httplib.HTTPResponse instance at 0x7fe85f462ab8>>

0 个答案:

没有答案