Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 26, 2021 09:49 pm GMT

Sending DELETE Requests In Python

What's a delete request

DELETE: is a request used to delete a specific resource in a server.

Sending a DELETE request in python

import requestsimport jsonurl = 'https://jsonplaceholder.typicode.com/posts/1'headers = {'Content-Type': 'application/json; charset=UTF-8'}response = requests.delete(url, headers=headers)print(response.status_code) # 200print(response.ok) # Trueprint(type(response.text)) # <class 'str'>print(response.url) # https://jsonplaceholder.typicode.com/posts/1print(response.headers['Content-Type']) # application/json; charset=utf-8print(response.encoding) # utf-8

Have a good day


Original Link: https://dev.to/ayabouchiha/sending-delete-requests-in-python-4057

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To