Re: Cannot upload media bundle using API (code from example)

2018-02-14 Thread 'Anash P. Oommen (AdWords API Team)' via AdWords API Forum
Hi Peter,

It is still possible that this will fail, due to 
this: 
https://greensock.com/forums/topic/17508-google-will-no-longer-support-html5-ads-with-clickability/.
 
The file pointed to by our guide uses ExitApi.js.

Cheers
Anash P. Oommen,
AdWords API Advisor.

On Wednesday, February 14, 2018 at 8:33:54 AM UTC-5, Peter Okunev wrote:
>
> Solved:
>
> a) hint from Michael to check the creative here 
> https://h5validator.appspot.com/adwords/asset
> b) the error I had is due to response = urllib.request.urlopen(url)
> url with redirects like https://goo.gl/9Y7qI2 does not catch the final 
> file
>
> On Monday, 8 January 2018 16:33:11 UTC+1, Michael Vinogradov wrote:
>>
>>
>> Hi
>>
>> Need help ! 
>> I trying upload html5 using API and get error 
>> MediaBundleError.INVALID_MEDIA_BUNDLE 
>> @ media[0].data.
>>
>> My code based on this example 
>> https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201708/Misc/UploadMediaBundle.php
>>
>>
>> Code:
>>
>>
>> $mediaService = $this->googleApiClient->get($this->session, 
>> MediaService::class);
>>
>> // Create HTML5 media and add it to the list.
>> $html5Zip = new MediaBundle();
>> $html5Zip->setData(file_get_contents('https://goo.gl/9Y7qI2'));
>> $html5Zip->setType(MediaMediaType::MEDIA_BUNDLE);
>> $mediaBundles = [$html5Zip];
>> // Upload the media bundle to the server.
>> $result = $mediaService->upload($mediaBundles);
>>
>>
>> SOAP file in attachment.
>>
>>
>> Thank you
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/275f826e-8fb2-404d-9f71-b52bba69e000%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot upload media bundle using API (code from example)

2018-02-14 Thread Peter Okunev
Solved:

a) hint from Michael to check the creative 
here https://h5validator.appspot.com/adwords/asset
b) the error I had is due to response = urllib.request.urlopen(url)
url with redirects like https://goo.gl/9Y7qI2 does not catch the final file

On Monday, 8 January 2018 16:33:11 UTC+1, Michael Vinogradov wrote:
>
>
> Hi
>
> Need help ! 
> I trying upload html5 using API and get error 
> MediaBundleError.INVALID_MEDIA_BUNDLE 
> @ media[0].data.
>
> My code based on this example 
> https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201708/Misc/UploadMediaBundle.php
>
>
> Code:
>
>
> $mediaService = $this->googleApiClient->get($this->session, 
> MediaService::class);
>
> // Create HTML5 media and add it to the list.
> $html5Zip = new MediaBundle();
> $html5Zip->setData(file_get_contents('https://goo.gl/9Y7qI2'));
> $html5Zip->setType(MediaMediaType::MEDIA_BUNDLE);
> $mediaBundles = [$html5Zip];
> // Upload the media bundle to the server.
> $result = $mediaService->upload($mediaBundles);
>
>
> SOAP file in attachment.
>
>
> Thank you
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/179cd9c3-35e7-4870-8d37-758af0c70ba9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot upload media bundle using API (code from example)

2018-02-13 Thread Peter Okunev
Hi Sreelakshmi, 

I have exactly the same error on python. 
In both cases me and Michael are using the example of a Media Bundle 
provided by Google: 'https://goo.gl/9Y7qI2'
I have also tried creating my own simple HTML5 consisting only of an image 
in Google Web Designer and got same error. 

Mistake response: 

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 
/Users/peterokunev/PycharmProjects/goeuro/src/projects/display/gdn_creative_manager/scripts/t_html5.py

Response summary - {'requestId': 0005651ad02a66600a379b4379097203, 
'responseTime': 297, 'serviceName': MediaService, 'methodName': upload, 
'operations': 1, 'isFault': True, 'faultMessage': 
'[MediaBundleError.INVALID_MEDIA_BUNDLE @ media[0].data]'}
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/util.py",
 
line 123, in PatchedHttpTransportSend
fp = self.u2open(u2request)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py",
 
line 132, in u2open
return url.open(u2request, timeout=tm)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
 
line 532, in open
response = meth(req, response)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
 
line 642, in http_response
'http', request, response, code, msg, hdrs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
 
line 570, in error
return self._call_chain(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
 
line 504, in _call_chain
result = func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
 
line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py",
 
line 613, in send
reply = self.options.transport.send(request)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/util.py",
 
line 134, in PatchedHttpTransportSend
raise suds.transport.TransportError(e.msg, e.code, e.fp)
suds.transport.TransportError: Internal Server Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Users/peterokunev/PycharmProjects/goeuro/src/projects/display/gdn_creative_manager/scripts/t_html5.py",
 
line 64, in 
main(adwords_client)
  File 
"/Users/peterokunev/PycharmProjects/goeuro/src/projects/display/gdn_creative_manager/scripts/t_html5.py",
 
line 43, in main
response = media_service.upload(media)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/common.py",
 
line 767, in MakeSoapRequest
self._packer) for arg in args])
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py",
 
line 521, in __call__
return client.invoke(args, kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py",
 
line 581, in invoke
result = self.send(soapenv)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py",
 
line 619, in send
description=tostr(e), original_soapenv=original_soapenv)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py",
 
line 670, in process_reply
raise WebFault(fault, replyroot)
suds.WebFault: Server raised fault: '[MediaBundleError.INVALID_MEDIA_BUNDLE 
@ media[0].data]'

Process finished with exit code 1

"""This example uploads an HTML5 zip file.
"""
from src import base_dir, config_chain, key_paths
import base64
import urllib.request
from googleads import adwords

API_VERSION = config_chain["adwords"]["api_version"]
PATH_ADWORDS_CREDENTIALS = key_paths["adwords"]
MAIN_MCC_ID = config_chain["adwords"]["main_client_customer_id"]
TEST_ACCOUNT_ID = config_chain["adwords"]["test_account_id"]


def main(client):
  # Initialize appropriate service.
  media_service = client.GetService('MediaService', version=API_VERSION)
  # Create HTML5 media.
  base64_encoded_html5_zip = GetBase64EncodedHTML5ZipFromUrl(
  'https://goo.gl/9Y7qI2')
  # Create a media bundle containing the zip file with all the HTML5 components.
  media = [{
  'xsi_type': 'MediaBundle',
  'data': base64_encoded_html5_zip,
  'type': 'MEDIA_BUNDLE'
  }]
  # Upload HTML5 zip.
  response = media_service.upload(media)

  if response:
for media in response:
  print(
  'HTML5 media with ID %d, dimensions %dx%d, and MIME type "%s" '
  'uploaded 

Re: Cannot upload media bundle using API (code from example)

2018-01-08 Thread 'Sreelakshmi Sasidharan (AdWords API Team)' via AdWords API Forum
Hi Michael, 

It looks like the media bundle that you are trying to upload has some 
issues. Could you please follow this 
 guide 
to validate your media bundle? Once you are able to fix the issues with 
that, the API call should work fine.

Thanks,
Sreelakshmi, AdWords API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/d6260cac-b71a-4926-b2df-58784b47fb3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.