Chilkat2-Python
Chilkat2-Python
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
http = chilkat2.Http()
# Keep the response body if there's an error.
http.KeepResponseBody = True
# Send the HTTP GET and return the content in a string.
str = http.QuickGetStr("https://www.chilkatsoft.com/helloWorld.json")
if (http.LastMethodSuccess == False):
if (http.LastStatus == 0):
# Communications error. We did not get a response.
print(http.LastErrorText)
else:
print("Response status code: " + str(http.LastStatus))
print("Response body error text:")
print(http.LastResponseBody)
sys.exit()
print(str)
print("Success")