Sample code for 30+ languages & platforms
Chilkat2-Python

Transition from Http.PutText to Http.HttpStr

Provides instructions for replacing deprecated PutText method calls with HttpStr.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()

verb = "PUT"
url = "https://example.com/"
textData = "This is the HTTP request body"
charset = "utf-8"
contentType = "text/plain"

# ------------------------------------------------------------------------
# The PutText method is deprecated:

responseBody = http.PutText(url,textData,charset,contentType,False,False)
if (http.LastMethodSuccess == False):
    print(http.LastErrorText)
    sys.exit()

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using HttpStr.
# Your application creates a new, empty HttpResponse object which is passed 
# in the last argument and filled upon success.

responseOut = chilkat2.HttpResponse()
success = http.HttpStr(verb,url,textData,charset,contentType,responseOut)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

responseBody = responseOut.BodyStr