4

I am using the requests.delete as follows:

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

This gives me the following error:

r=requests.delete(url, json.dumps(data))
TypeError: delete() takes exactly 1 argument (2 given)

Why do I get this error?

1 Answer 1

4

The requests.delete function has the following signature:

requests.delete(url, **kwargs)

There's only one required positional argument, url, and the rest should be keyword arguments, the same as for requests.request function.

Your json.dumps(data) then surely doesn't give proper format of keyword arguments. If you just want to pass this JSON as data, do:

requests.delete(url, data=json.dumps(data))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.