网络编程
位置:首页>> 网络编程>> Python编程>> python3 http提交json参数并获取返回值的方法

python3 http提交json参数并获取返回值的方法

作者:药杉  发布时间:2023-09-26 12:30:06 

标签:python3,http,json

如下所示:


import json
import http.client

connection = http.client.HTTPSConnection('spd.aiopos.cn')

headers = {'Content-type': 'application/json'}

values = {
'acct_pan':'6226011****83678',
'acct_name':'张三',
'cert_type':'01',
'cert_id':'37293019****95',
'phone_num':'1516××××02'
}

json_foo = json.dumps(values)

connection.request('POST', '/authen/verifi?access_token=e2011a', json_foo, headers)

response = connection.getresponse()
print(response.read().decode())

来源:https://blog.csdn.net/lizhe_dashuju/article/details/80592564

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com