Re: From service to JSON

2018-10-25 Thread Dorian Kind
Hi Osso,

you can use the `zeep.helpers.serialize_object` helper to convert a SOAP 
object as returned by zeep into a native dict and then turn that into JSON 
via `json.dumps`.

Cheers,
Dorian

On Thursday, 25 October 2018 09:49:33 UTC+2, Osso romain wrote:
>
> Hi 
>
> When i'm getting the datas from a service :
>
> datas = adwords_client.GetService('AdGroupAdService', 'v201809').get(
> selector)
> datas = datas['entries']
>
> print(str(datas))
>
> it will pint something like this :
>
> [{
> 'id': 1xx,
> 'campaignGroupId': None,
> 'name': '1xe',
> 'status': 'PAUSED',
> 'servingStatus': 'SERVING',
> 'startDate': 'xx',
> 'endDate': 'x0',
> 'budget': {
> 'budgetId': xx,
> 'name': 'Budget Marque',
> 'amount': {
> 'ComparableValue.Type': 'Money',
> 'microAmount': 8000
> },
> 'deliveryMethod': 'STANDARD',
> 'referenceCount': 17,
> 'isExplicitlyShared': True,
> 'status': 'ENABLED'
> },
>
> Which is not json formator xml format.
>
> So let's print the type of "datas". 
> It is a list of "zeep.objects.Campaign". I think it's a class of 
> campaigns. But how do i do to get it in XML or either json ? 
>
> There are no informations about that on the sdk .
>
> Service used : 
> https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService
> Sdk : 
> https://developers.google.com/adwords/api/docs/samples/python/campaign-management
>  
>
> Thanks for your help,
>
> Regards 
> Le mercredi 24 octobre 2018 19:54:36 UTC+2, Milind Sankeshware (AdWords 
> API Team) a écrit :
>>
>> Hi Osso,
>>
>> I am afraid that you will get the data in XML format only. However, you 
>> could convert the response in XML to JSON at your end. Please find the 
>> sample 
>> examples 
>> 
>>  from 
>> the stack overflow, which might be helpful for you. Let me know if you have 
>> any further questions. 
>>
>> Thanks,
>> Milind, AdWords API Team
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads 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/7df02a81-36bb-4e3c-95f8-d7566dadd4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: From service to JSON

2018-10-25 Thread Osso romain
Hi 

When i'm getting the datas from a service :

datas = adwords_client.GetService('AdGroupAdService', 'v201809').get(
selector)
datas = datas['entries']

print(str(datas))

it will pint something like this :

[{
'id': 1xx,
'campaignGroupId': None,
'name': '1xe',
'status': 'PAUSED',
'servingStatus': 'SERVING',
'startDate': 'xx',
'endDate': 'x0',
'budget': {
'budgetId': xx,
'name': 'Budget Marque',
'amount': {
'ComparableValue.Type': 'Money',
'microAmount': 8000
},
'deliveryMethod': 'STANDARD',
'referenceCount': 17,
'isExplicitlyShared': True,
'status': 'ENABLED'
},

Which is not json formator xml format.

So let's print the type of "datas". 
It is a list of "zeep.objects.Campaign". I think it's a class of campaigns. 
But how do i do to get it in XML or either json ? 

There are no informations about that on the sdk .

Service used : 
https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService
Sdk 
: 
https://developers.google.com/adwords/api/docs/samples/python/campaign-management
 

Thanks for your help,

Regards 
Le mercredi 24 octobre 2018 19:54:36 UTC+2, Milind Sankeshware (AdWords API 
Team) a écrit :
>
> Hi Osso,
>
> I am afraid that you will get the data in XML format only. However, you 
> could convert the response in XML to JSON at your end. Please find the sample 
> examples 
> 
>  from 
> the stack overflow, which might be helpful for you. Let me know if you have 
> any further questions. 
>
> Thanks,
> Milind, AdWords API Team
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads 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/a874f79e-f92a-4868-a33c-2c69d8915dc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: From service to JSON

2018-10-24 Thread 'Milind Sankeshware (AdWords API Team)' via AdWords API and Google Ads API Forum
Hi Osso,

I am afraid that you will get the data in XML format only. However, you 
could convert the response in XML to JSON at your end. Please find the sample 
examples 

 from 
the stack overflow, which might be helpful for you. Let me know if you have 
any further questions. 

Thanks,
Milind, AdWords API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads 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/f962b02a-1df8-469c-9c3c-516596e4db30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


From service to JSON

2018-10-24 Thread Osso romain
Hey, i'm using the adword api for a while but only for a reporting purpose.
 
Presently to extract the "structure" of my ads, adgroups, campaigns etc. 
I'm using the python SDK.
 
My question is how could I save the datas I get from a service as 
" AdGroupAdService " in JSON ? 

Is there a function in the sdk ? I cannot find anything on the documentation
 
Thanks for help.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads 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/caab2951-8205-4c52-84ae-19f1d88ee1ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.