Python: requests data transmission format json

Import Requests
 Import json 
 
Data = {
     ' A ' : 123 ,
     ' B ' : 456 
} 
 
# headers added to the content-type this parameter is specified as json format 
headers = { ' the Content-the Type ' : ' file application / json ' } 
 
# the packet format is converted into json 
Response = requests.post (URL = ' URL ' , headers = headers, json.dumps = data (data))

 

Guess you like

Origin www.cnblogs.com/ScarecrowMark/p/11529634.html