(Chilkat2-Python) Transition from Http.PostBinary to Http.HttpBinary
Provides instructions for replacing deprecated PostBinary method calls with HttpBinary. Note: This example requires Chilkat v11.0.0 or greater.
import sys
import chilkat2
success = False
http = chilkat2.Http()
verb = "POST"
url = "https://example.com/"
contentType = "application/octet-stream"
# ------------------------------------------------------------------------
# The PostBinary method is deprecated:
responseBody = http.PostBinary(url,byteData,contentType,False,False)
if (http.LastMethodSuccess == False):
print(http.LastErrorText)
sys.exit()
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using HttpBinary.
responseOut = chilkat2.HttpResponse()
success = http.HttpBinary(verb,url,byteData,contentType,responseOut)
if (success == False):
print(http.LastErrorText)
sys.exit()
responseBody = responseOut.BodyStr
|