Sample code for 30+ languages & platforms
Chilkat2-Python

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()

verb = "POST"
url = "https://example.com/"
bdRequestBody = chilkat2.BinData()
contentType = "application/octet-stream"

# ------------------------------------------------------------------------
# The PBinaryBd method is deprecated:

# responseObj is a CkHttpResponse
responseObj = http.PBinaryBd(verb,url,bdRequestBody,contentType,False,False)
if (http.LastMethodSuccess == False):
    print(http.LastErrorText)
    sys.exit()

# ...
# ...

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

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