Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用请求库执行HTTP删除请求_Python_Django_Httprequest - Fatal编程技术网

Python 如何使用请求库执行HTTP删除请求

Python 如何使用请求库执行HTTP删除请求,python,django,httprequest,Python,Django,Httprequest,我正在使用这个包与toggl.com API进行交互 我可以执行GET和POST请求: payload = {'some':'data'} headers = {'content-type': 'application/json'} url = "https://www.toggl.com/api/v6/" + data_description + ".json" response = requests.post(url, data=json.dumps(payl

我正在使用这个包与toggl.com API进行交互

我可以执行GET和POST请求:

    payload = {'some':'data'}
    headers = {'content-type': 'application/json'}
    url = "https://www.toggl.com/api/v6/" + data_description + ".json"
    response = requests.post(url, data=json.dumps(payload), headers=headers,auth=HTTPBasicAuth(toggl_token, 'api_token'))
但我似乎找不到执行删除请求的方法。 这可能吗

使用而不是
请求。post

payload={'some':'data'}
headers={'content-type':'application/json'}
url=”https://www.toggl.com/api/v6/“+数据描述+”.json”
response=requests.delete(
网址,
data=json.dumps(有效负载),
标题=标题,
auth=HTTPBasicAuth(toggl_令牌,“api_令牌”)
)
import requests
url = 'url.example.ap'
headers = {
    'content-type': "multipart/form-data; boundary=---- ",
    'X-Auth-Token': ""anytoken"",
    'Cache-Control': "no-cache"
    }
r = requests.delete(url, headers=headers)
n = os.write(sys.stdout.fileno(), r.content)
print r.content == r.text