[Solved] How to get “PDF” file from the binary data of SoftLayer’s quote?


the method return a binary data encoded in base 64, what you need to do is decode the binary data.

see this article about enconde and decode binary data.

https://code.tutsplus.com/tutorials/base64-encoding-and-decoding-using-python–cms-25588

the Python client returns a xmlrpc.client.Binary object so you need to work with that object here an example using the Python client and Python 3

#!/usr/bin/env python

import SoftLayer
import xmlrpc.client
import base64
import os

USERNAME = 'set me'
API_KEY = 'set me'

quoteId = 1560845

client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)

accountClient = client['SoftLayer_Billing_Order_Quote']
binaryData = accountClient.getPdf(id=quoteId)
decodeBinary = binaryData.data
file = open('test.pdf','wb')
file.write(decodeBinary)

Regards

solved How to get “PDF” file from the binary data of SoftLayer’s quote?