python3 the POST request URL

Method a: Module requests using

Import Requests RQ AS
 Import JSON 

DEF funcpost (): 
    URL = ' HTTP: //www.***.com/ '   # the URL address to be requested 
    data = { ' ID ' : 123} # the POST request requires data submitted 
    data json.dumps = (data)   # when the data sometimes require json type 
    headers = { ' Content-type ' : file application / json}   # one kind of request header needs to carry the 

    RES = rq.post (URL = URL, data = data, headers = deaders)   # initiation request 
    the traget res.json = ()   # the acquired data into json type 
    return target

funcpost()

 

Guess you like

Origin www.cnblogs.com/aaronthon/p/11609089.html