CkPython
CkPython
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 CkPython Downloads
import sys
import chilkat
success = False
http = chilkat.CkHttp()
resp = chilkat.CkHttpResponse()
# 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.get_StatusCode()))
print("Response body:")
print(resp.bodyStr())