Sample code for 30+ languages & platforms
CkPython

Example: Http.DownloadSb method

See more HTTP Examples

Demonstrates the DownloadSb method.

Chilkat CkPython Downloads

CkPython
import chilkat

success = False

http = chilkat.CkHttp()
http.put_KeepResponseBody(True)

sb = chilkat.CkStringBuilder()
success = http.DownloadSb("https://chilkatsoft.com/testData/helloWorld.txt","utf-8",sb)

statusCode = http.get_LastStatus()
if (success == False):
    if (statusCode == 0):
        # Unable to either send the request or get the response.
        print(http.lastErrorText())
    else:
        # We got a response, but the status code was not in the 200s
        print("Response status code: " + str(statusCode))
        # Examine the response body.
        print("Response body:")
        print(http.lastResponseBody())

    print("Download failed.")

else:
    print("Download success, response status = " + str(statusCode))
    print(sb.getAsString())