DownloadReportToFile skips final chunk
@wihl がすでに取り組んでいます。
2018年11月28日 から。
評価
この issue はまだ評価されていません。
説明
I have a problem where reports are simply terminated too soon.
I am uncertain about the exact cause, but doing a simple division:
file_size / chunk_size = 495.0
I find that my files are suspiciously exactly n * chunk size of (16 * 1024)
The faulty behaviour seems to only happen at the very end of the file, which I guess indicates something about the final chunk of the response byte stream.
If anyone at Google can reference report ids, report number 11035210012 results in the described fault, when using the code below.
This code snippet reliably reproduces the problem for me. Which is functionally identical to the example in this repo:
# Initialize client object.
yaml_path = "~/googleads.yaml"
client = ad_manager.AdManagerClient.LoadFromStorage(yaml_path)
first_date = date(2018, 9, 14)
last_date = date(2018, 9, 14)
# Initialize a DataDownloader.
report_downloader = client.GetDataDownloader(version='v201805')
# Create report job.
report_job = {
'reportQuery': {
'dimensions': [
'DATE',
'ORDER_ID', 'ORDER_NAME',
'LINE_ITEM_ID', 'LINE_ITEM_NAME', 'LINE_ITEM_TYPE',
'AD_UNIT_ID', 'AD_UNIT_NAME',
'CREATIVE_ID', 'CREATIVE_NAME', 'CREATIVE_SIZE' # ,
],
'columns': ['TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS',
'TOTAL_LINE_ITEM_LEVEL_CLICKS',
'TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE'],
# 'customFieldIds': ['8918', '12638'],
'dateRangeType': 'CUSTOM_DATE',
'startDate': first_date,
'endDate': last_date,
}
}
try:
# Run the report and wait for it to finish.
report_job_id = report_downloader.WaitForReport(report_job)
except errors.AdManagerReportError as e:
print('Failed to generate report. Error was: %s' % e)
# Change to your preferred export format.
export_format = 'CSV_DUMP'
report_file = tempfile.NamedTemporaryFile(suffix='.csv', delete=False)
# Download report data.
report_downloader.DownloadReportToFile(report_job_id, export_format, report_file, use_gzip_compression=False)
# Display results.
print('Report job with id "%s" downloaded to:\n%s' % (
report_job_id, report_file.name)) # report_file.name))
chunk_size = (16 * 1024) # chunk size used for report downloader
file_size = os.path.getsize(report_file.name)
print(file_size / chunk_size) # suspicious integer value
- 主要言語
- Python
- スター
- 749
- フォーク
- 967
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleads/googleads-python-lib のほかの issue
-
[Bug] Potential Billion Laughs Attack Vector via Unrestricted XML Parsing in `ZeepSchemaHelper` オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
image-package オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
googleads/googleads-python-lib の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·