Posts under category google-ads-api

I want to deploy working python project in pycharm to aws lambda. The project is using google-ads library to get some report data from google ads.

I tried deploying lambda by importing complete project as a zip file by zipping all the folders/files inside the project and not the project folder itself. But i got the following error:

{ "errorMessage": "Unable to import module 'main': cannot import name 'cygrpc' from 'grpc._cython' (/var/task/grpc/_cython/__init__.py)", "errorType": "Runtime.ImportModuleError", "stackTrace": [] } 

Assuming that google-ads library is working and that something is wrong with grpc(btw google-ads includes grpcio and stuff on its own), i tried to create a layer for grpcio, cython, cygrpc but the error remains same.

I create projects/layers in aws lambda and they work. I dont know what i am doing wrong here.

Any help would be really appreciated!

versions: google-ads-14.1.0, python-3.9, grpcio-1.43.0

I'm trying to use curl with google ads api after generating access token through curl also and try to use this command

curl -i --request POST https://googleads.googleapis.com/v9/customers/2260416591:generateKeywordIdeas \ --header "Content-Type:application/json" \ --header "login-customer-id: 2260416591\ --header "developer-token: z2sb0uyekDzkMbiyNpAImg" \ --header "Authorization: Bearer ya29.A0ARrdaM9-2ZnG42VSl3mfrst_A8Rj5UoR6J0kJlMo-wGpCCgcOH1srTaSCKuVnHAoKHUPjx52bkPNUkLb7BydNycv7_6-5cryNOp7EZc6B4QK8vQ5-gI6Zy_XB1eCwIocwh508RIJxIgoPrx0PqOwLXlB332BeA" \ --data '{ "keywordSeed": { "keywords": [ "coffee" ] } }' 

I get this error

HTTP/1.0 411 Length Required Content-Type: text/html; charset=UTF-8 Referrer-Policy: no-referrer Content-Length: 1564 Date: Thu, 20 Jan 2022 13:07:10 GMT <!DOCTYPE html> <html lang=en>   <meta charset=utf-8>   <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">   <title>Error 411 (Length Required)!!1</title>   <style>     *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}   </style>   <a href=//www.google.com/><span id=logo aria-label=Google></span></a>   <p><b>411.</b> <ins>That’s an error.</ins>   <p>POST requests require a <code>Content-length</code> header.  <ins>That’s all we know.</ins> curl: (6) Could not resolve host: \ curl: (6) Could not resolve host: \ curl: (3) URL using bad/illegal format or missing URL curl: (6) Could not resolve host: Bearer curl: (3) nested brace in URL position 192: ya29.A0ARrdaM9-2ZnG42VSl3mfrst_A8Rj5UoR6J0kJlMo-wGpCCgcOH1srTaSCKuVnHAoKHUPjx52bkPNUkLb7BydNycv7_6-5cryNOp7EZc6B4QK8vQ5-gI6Zy_XB1eCwIocwh508RIJxIgoPrx0PqOwLXlB332BeA \ --data '{ keywordSeed: { keywords: [ coffee ] } }' 

What's the problem here? for sure this token not working anymore but this error dumped each time I try to use curl to generate keywordsideas through google ads api

im trying to use get functions for reports under googleads.

#My code

from googleads import adwords from googleads import errors import time import datetime import os import sys if __name__ == '__main__':   ## initialize google adwords client object   adwords_client = adwords.AdWordsClient.LoadFromStorage("googleAds.yaml")   ## set your customer-ID   adwords_client.SetClientCustomerId('389204095687-xx.apps.googleusercontent.com')   report_downloader = adwords_client.GetReportDownloader(version='v9')   ## get CLICK_PERFORMANCE report for yesterday as an example   report_date = datetime.datetime.now()-datetime.timedelta(days=1)   report_date_string = report_date.strftime("%Y%m%d")   ## build the report query   report_query = (adwords.ReportQueryBuilder()       .Select('campaign.id','ad_group.id', 'metrics.impressions', 'metrics.clicks')       .From('ad_group')       .During(start_date=report_date_string,end_date=report_date_string)       .Build())   ## download the report as CSV into string   csv_report = report_downloader.DownloadReportWithAwql(       report_query, 'CSV', skip_report_header=True,       skip_column_header=True, skip_report_summary=True,       include_zero_impressions=False)    

But i receive the below traceback error-

   with open(path, 'rb') as handle: FileNotFoundError: [Errno 2] No such file or directory: 'googleAds.yaml' During handling of the above exception, another exception occurred: Traceback (most recent call last):   File "<ipython-input-5-d90ad0259074>", line 16, in <module>     adwords_client = adwords.AdWordsClient.LoadFromStorage("googleAds.yaml")   File "C:\Users\jj\AppData\Local\Continuum\anaconda3\lib\site-packages\googleads\adwords.py", line 193, in LoadFromStorage     cls._OPTIONAL_INIT_VALUES))   File "C:\Users\jj\AppData\Local\Continuum\anaconda3\lib\site-packages\googleads\common.py", line 247, in LoadFromStorage     'Given yaml file, %s, could not be opened.' % path) GoogleAdsValueError: Given yaml file, googleAds.yaml, could not be opened. 

I reviewed the documentation for Oath: https://github.com/googleads/googleads-python-lib/wiki/API-access-using-own-credentials-(installed-application-flow)#step-2---setting-up-the-client-library

but I already have all the credentials, i just dont know how to create the yml file and save it where python can detect it

I am using a third-party tool that use the Adwords Reporting https://developers.google.com/adwords/api/docs/appendix/reports/all-reports to retrieve data.

At the moment all the "Performance Max" campaigns are lost from the Adwords Reporting and I need to retrieve them to include their costs. With the migration from Adwords to Ads, also, I need to find a solution before April 2022.

I only need to move that data into my Google BigQuery project.

At the moment the solution using the BigQuery Data Transfer is NOT OK because use the same v201809 reporting of Adwords ( https://cloud.google.com/bigquery-transfer/docs/adwords-transfer?hl=en-GB ) .

Also the Google Ads Script don't support Google Ads but only report name of Adwords v201809 ( https://developers.google.com/google-ads/scripts/docs/solutions/bigquery-exporter )

Do you have a suggestion to help me? Thanks