def testDownloadReportWithRequestLogDisabled(self):
    """Tests if we can download a report with request logging disabled."""
    client = AdWordsClient(path=os.path.join('..', '..', '..'))
    client._config['request_log'] = 'n'  # pylint: disable=W0212
    report_downloader = client.GetReportDownloader()
    report = {
        'reportName': 'Last 7 days CRITERIA_PERFORMANCE_REPORT',
        'dateRangeType': 'LAST_7_DAYS',
        'reportType': 'CRITERIA_PERFORMANCE_REPORT',
        'downloadFormat': 'CSV',
        'selector': {
            'fields': ['CampaignId', 'AdGroupId', 'Id', 'CriteriaType',
                       'Criteria', 'Impressions', 'Clicks', 'Cost']
        },
        # Enable to get rows with zero impressions.
        'includeZeroImpressions': 'false'
    }

    report_downloader.DownloadReport(report)
Exemple #2
0
    def testRegenerateTokenInReportDownload(self):
        """Tests if the report download token regeneration logic works.."""
        client = AdWordsClient(path=os.path.join('..', '..', '..'))
        report_downloader = client.GetReportDownloader()
        report_downloader._config['auth_token_epoch'] = 0

        report = {
            'reportName': 'Last 7 days CRITERIA_PERFORMANCE_REPORT',
            'dateRangeType': 'LAST_7_DAYS',
            'reportType': 'CRITERIA_PERFORMANCE_REPORT',
            'downloadFormat': 'CSV',
            'selector': {
                'fields': [
                    'CampaignId', 'AdGroupId', 'Id', 'CriteriaType',
                    'Criteria', 'Impressions', 'Clicks', 'Cost'
                ]
            },
            # Enable to get rows with zero impressions.
            'includeZeroImpressions': 'false'
        }

        report_downloader.DownloadReport(report)