I have the following python code:

```
def _upload_image_asset(client, customer_id, image_url, image_width,
                        image_height):
    # Download image from URL
    image_content = requests.get(image_url).content

    asset_operation = client.get_type('AssetOperation', version='v2')
    asset = asset_operation.create
    # Optional: Provide a unique friendly name to identify your asset. If 
you
    # specify the name field, then both the asset name and the image being
    # uploaded should be unique, and should not match another ACTIVE asset 
in
    # this customer account.
    #asset.name.value = f'Jupiter Trip #{uuid4()}'
    asset_type_enum = client.get_type('AssetTypeEnum', version='v2')
    asset.type = asset_type_enum.IMAGE
    image_asset = asset.image_asset
    image_asset.data.value = image_content
    image_asset.file_size.value = len(image_content)
    image_asset.mime_type = client.get_type('MimeTypeEnum').IMAGE_JPEG
    image_asset.full_size.width_pixels.value = image_width
    image_asset.full_size.height_pixels.value = image_height
    image_asset.full_size.url.value = image_url

```
In this case I get the image from a URL. However I want to upload it from a 
file at my local pc. There is any way to do this? I didn't find any method 
at the documentation.

Thank you


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c5e4f18e-f331-48b5-bc93-6a07748ce37d%40googlegroups.com.

Reply via email to