Wednesday, March 8, 2023

Digest for adsense-api@googlegroups.com - 2 updates in 1 topic

Kulvinder Tuteja <ascendeum.weblog@gmail.com>: Mar 06 11:14PM -0800

Hi,
I'm trying to create an api script with python for Adsense.
I have already created the application with the scopes and using the
client_id and client_secret I have also generated the refresh token. Is
there a way to initialise a client and service for adsense like it is there
in the admanager API?
 
For instance, I'm using the following code snippet in python to create
oauth using client_d, client_secret and refresh_token
 
try:
oauth2_client = oauth2.GoogleRefreshTokenClient(
client_id, client_secret, refresh_token)
except Exception as err:
return f"Google Refresh Token Authentication Error: {str(err)}"
 
Then I use the following snippet to initialise the client and use a service
 
# Initialize AdManager Client.
client = ad_manager.AdManagerClient(oauth2_client, "DFP API", network_code)
# Initialize a service.
report_service = client.GetService('ReportService')
 
Is there a similar way for Adsense API to initialise a client using
client_id, client_secret and refresh token and then use a service?
Ad Sense API <adsenseapi@forumsupport.google>: Mar 07 05:52PM

Hi Kulvinder,
 
Thanks for your email. There is a selection of sample code available at https://developers.google.com/adsense/management/libraries, including python examples. Hopefully something there will help.
 
Regards,
Andrew (AdSense API team)
ref:_00D1U1174p._5004Q2jWz3m:ref
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to adsense-api+unsubscribe@googlegroups.com.

No comments:

Post a Comment