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

你可能感兴趣的:(python3 http提交json参数并获取返回值)