之前写过一篇文章关于python CURL模块的,在这里我们从urllib来实现同样的功能。具体代码如下:

import urllib
import urllib2
import json

#发起请求的url
post_url = 'http://www.test.baidu.com';

postData  = {'a':'aaa','b':'bbb','c':'ccc','d':'ddd'}
#json序列化
data = json.dumps(postData)
	
req = urllib2.Request(post_url)
response = urllib2.urlopen(req,urllib.urlencode({'sku_info':data}))

#打印返回值
print response.read()

 对方接收sku_info参数即可,然后解析json参数

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2021-08-12
  • 2021-12-30
  • 2022-01-01
  • 2021-10-18
  • 2021-07-10
猜你喜欢
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-11-18
  • 2021-07-30
  • 2022-01-20
相关资源
相似解决方案