CkPython
CkPython
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat CkPython Downloads
import sys
import chilkat
http = chilkat.CkHttp()
# Keep the response body if there's an error.
http.put_KeepResponseBody(True)
# Send the HTTP GET and return the content in a string.
str = http.quickGetStr("https://www.chilkatsoft.com/helloWorld.json")
if (http.get_LastMethodSuccess() == False):
if (http.get_LastStatus() == 0):
# Communications error. We did not get a response.
print(http.lastErrorText())
else:
print("Response status code: " + str(http.get_LastStatus()))
print("Response body error text:")
print(http.lastResponseBody())
sys.exit()
print(str)
print("Success")