python使用post方式发送json参数
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
在使用微盟的接口时,遇到这样的规定:
1、正向接口以’Content-Type: application/json’ 格式推送至微盟平台
2、所有正向接口的调用均以post方式提交,并且post中的参数均以json方式构成。
一开始没看懂,不知道什么玩意.百度后,找到了个靠谱的帖子,照着方案写代码后成功,把相关代码贴出来,供以后作参考
import urllib2
import json
data = {
'a': 123,
'b': 456
}
headers = {'Content-Type': 'application/json'}
request = urllib2.Request(url='url', headers=headers, data=json.dumps(data))
response = urllib2.urlopen(request)
主要是head要加一段代码指明用Json方式发送




适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
68c25aec
* :memo: update customers
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
* :memo: add badge to Cloudback
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
---------
Signed-off-by: Niels Lohmann <mail@nlohmann.me> 3 天前
ac0133ea
Bumps [mkdocs-git-revision-date-localized-plugin](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases)
- [Commits](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/compare/v1.4.5...v1.4.6)
---
updated-dependencies:
- dependency-name: mkdocs-git-revision-date-localized-plugin
dependency-version: 1.4.6
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 4 天前
更多推荐
所有评论(0)