googleads-python-lib icon indicating copy to clipboard operation
googleads-python-lib copied to clipboard

mistake on python example of create_custom_creative

Open schunlee opened this issue 6 years ago • 0 comments

@grivescorbett according to the api document, the type of assetByteArray attribute should be base64Binary, but the example set the content of image data directly, as below

   `image_data = open(os.path.join(os.path.split(__file__)[0], '..', '..', 'data', medium_rectangle.jpg'), 'r').read()

     ... ...

     'asset': {
                   'assetByteArray': image_data,
                   'fileName': 'image%s.jpg' % uuid.uuid4()
                   }
     ` 

the correct one should be:

     ` 'asset': {
                   'assetByteArray': base64.b64encode(image_data),
                   'fileName': 'image%s.jpg' % uuid.uuid4()
                   }
     `

schunlee avatar Feb 11 '19 05:02 schunlee