Sample code for 30+ languages & platforms
Chilkat2-Python

Example: Http.HttpNoBody method

Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()
resp = chilkat2.HttpResponse()

# Send a DELETE request to https://api.example.com/users/123
url = "https://api.example.com/users/123"
success = http.HttpNoBody("DELETE",url,resp)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

print("Response Status Code: " + str(resp.StatusCode))
print("Response body:")
print(resp.BodyStr)