如下所示:

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())

以上这篇python3 http提交json参数并获取返回值的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

收藏 打印