Last active
July 7, 2021 12:00
-
-
Save limata3/a39853cfb2c05141efcba856e07b0d9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from googleads import adwords | |
| from googleads import oauth2 | |
| def connect_to_adwords_api(): | |
| customer_id = 'xxx-xxx-xxxx' # This is client customer ID you see in the google ads UI | |
| oauth2_client = oauth2.GoogleRefreshTokenClient( | |
| client_id={GOOGLE_CLIENT_ID}, | |
| client_secret={GOOGLE_CLIENT_SECRET}, | |
| refresh_token={GOOGLE_REFRESH_TOKEN} | |
| ) | |
| adwords_client = adwords.AdWordsClient( | |
| developer_token={GOOGLE_DEVELOPER_TOKEN}, | |
| oauth2_client=oauth2_client, | |
| user_agent='marketing_data', | |
| client_customer_id=customer_id | |
| ) | |
| return adwords_client |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment