Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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_Http_Python Requests_Http Delete - Fatal编程技术网

Python 使用请求模块的HTTP删除消息

Python 使用请求模块的HTTP删除消息,python,http,python-requests,http-delete,Python,Http,Python Requests,Http Delete,我正在使用请求。删除如下: r=requests.delete(url, json.dumps(data)) 这给了我以下错误: r=requests.delete(url, json.dumps(data)) TypeError: delete() takes exactly 1 argument (2 given) 为什么会出现此错误?函数具有以下签名: requests.delete(url, **kwargs) 只有一个必需的位置参数,url,其余应为关键字参数,与函数相同 您的j

我正在使用
请求。删除
如下:

r=requests.delete(url, json.dumps(data))
这给了我以下错误:

r=requests.delete(url, json.dumps(data))
TypeError: delete() takes exactly 1 argument (2 given)
为什么会出现此错误?

函数具有以下签名:

requests.delete(url, **kwargs)
只有一个必需的位置参数,
url
,其余应为关键字参数,与函数相同

您的
json.dumps(data)
显然没有给出正确的关键字参数格式。如果您只想将此JSON作为数据传递,请执行以下操作:

requests.delete(url, data=json.dumps(data))