Just use the requests.request()
method. First argument is the HTTP verb that you want to use. requests.get()
, requests.post()
, etc. are just aliases to request('GET')
, request('POST')
: see the doc
Your code becomes:
verb = 'POST'
response = requests.request(
verb,
headers=self.auth,
url=self.API + '/zones/' + str(zID) + '/dns_records',
data={"type":record[0], "name":record[1], "content":record[2]}
)