Sample code for 30+ languages & platforms
Chilkat2-Python

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()

# Send the HTTP GET and return the content in a StringBuilder
sb = chilkat2.StringBuilder()
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb)
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(sb.GetAsString())

    sys.exit()

# The downloaded content:
print(sb.GetAsString())
print("Success")