Hi Peter,
Running the following:
import sys
from googleads import adwords
# Specify where to download the file here.
PATH = 'C:/Users/Desktop/Python/supernova/report_download.csv'
def main(client):
# Initialize appropriate service.
report_downloader = client.GetReportDownloader(version='v201802')
# Construct query and get all campaigns.
report_query = (adwords.ReportQueryBuilder()
.Select('CampaignName', 'AdGroupName', 'HeadlinePart1',
'HeadlinePart2', 'Description', 'Clicks','Cost','AverageCpc','Labels')
.From('AD_PERFORMANCE_REPORT')
.Where('CampaignStatus').EqualTo('ENABLED')
.Where('Clicks').GreaterThan('0')
.During('YESTERDAY')
.Build())
report_downloader.DownloadReportWithAwql(
report_query, 'CSV', PATH, skip_report_header=False,
skip_column_header=False, skip_report_summary=False,
include_zero_impressions=True)
produces the following error:
AttributeError: 'str' object has no attribute 'write'
If i keep the sys.stdout vs. PATH, then the file fails to write to the path
Best,
On Monday, April 23, 2018 at 1:36:40 AM UTC-7, Peter Oliquino (AdWords API
Team) wrote:
>
> Hi John,
>
> Your current report definition is already set to generate a CSV file as
> you can see below :
>
> report_downloader.DownloadReportWithAwql(
> report_query, 'CSV', sys.stdout, skip_report_header=False,
> skip_column_header=False, skip_report_summary=False,
> include_zero_impressions=True)
>
>
> The file should then be downloaded straight to the folder you specified in
> your PATH :
>
> PATH = '/<your folder>/report_download.csv'
>
>
> This being said, could you confirm if you are not yet able to see the
> generated CSV file when you run the report request?
>
> Best regards,
> Peter
> AdWords API Team
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
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/1fe11702-9e48-4f1d-b41d-7dc0e75f0f71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.