CkPython
CkPython
Transition from Http.PFile to Http.HttpFile
Provides instructions for replacing deprecated PFile method calls with HttpFile.Chilkat CkPython Downloads
import sys
import chilkat
success = False
http = chilkat.CkHttp()
verb = "POST"
url = "https://example.com/"
localFilePath = "c:/temp/requestBodyContent.dat"
contentType = "application/octet-stream"
# ------------------------------------------------------------------------
# The PFile method is deprecated:
# responseObj is a CkHttpResponse
responseObj = http.PFile(verb,url,localFilePath,contentType,False,False)
if (http.get_LastMethodSuccess() == False):
print(http.lastErrorText())
sys.exit()
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using HttpFile.
# Your application creates a new, empty HttpResponse object which is passed
# in the last argument and filled upon success.
responseOut = chilkat.CkHttpResponse()
success = http.HttpFile(verb,url,localFilePath,contentType,responseOut)
if (success == False):
print(http.lastErrorText())
sys.exit()