Skip to content
Branch: master
Find file History
Latest commit ae4de1b May 16, 2014
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md Fixes README. Mar 10, 2014
adsense_util.py Adds a more powerful data collator to fill chronological gaps and com… May 16, 2014
adsense_util_data_collator.py Adds a more powerful data collator to fill chronological gaps and com… May 16, 2014
adsense_util_data_collator_test.py Adds a more powerful data collator to fill chronological gaps and com… May 16, 2014
client_secrets.json First commit, adsense management api samples for v1.4 Mar 10, 2014
generate_report.py Adds a more powerful data collator to fill chronological gaps and com… May 16, 2014
generate_report_with_paging.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_account_tree.py
get_all_accounts.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_ad_clients.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_ad_clients_for_account.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_ad_units.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_ad_units_for_custom_channel.py
get_all_alerts.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_custom_channels.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_custom_channels_for_ad_unit.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_dimensions.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_metrics.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_payments.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_saved_ad_styles.py
get_all_saved_reports.py First commit, adsense management api samples for v1.4 Mar 10, 2014
get_all_url_channels.py First commit, adsense management api samples for v1.4 Mar 10, 2014

README.md

AdSense Management API v1.4 Samples

A collection of command-line samples for the AdSense Management API.

##Installation and first request

  1. Download Google APIs Client Library for Python (google-api-python-client): https://code.google.com/p/google-api-python-client/

or use pip:

$ pip install google-api-python-client
  1. Make sure you can import the client library:
$ python
>>> import apiclient
  1. Execute any of the scripts to begin the auth flow:
$ python get_all_accounts.py

A browser window will open and ask you to login. Use the AdSense account.

  1. Accept the permissions dialog. The browser should display

The authentication flow has completed.

Close the window and go back to the shell.

  1. The script will output:

Account with ID "pub-1234567890123456" and name "My account" was found.

  1. The tokens will be stored in adsense.dat.

Remove this file to restart the auth flow.

You can’t perform that action at this time.