#coding:utf-8 import requests,json #第一行註解的#coding:utf-8表示能夠支持中文,否則代碼裏面有中文會報錯 url = "http://xxx" headers = {"Content-Type":"application/json","Authorization":"Bearer token值"} data1 = {"key1":"value1","key2":"value2"} data = {"params":data1} #方法一 r = request.post(url = url,data = json.dumps(data),headers = headers) #方法二 #r = request.post(url = url,json = data,headers = headers) print(r) print(r.text) print(r.url)