Skip to content

Commit 058d1ab

Browse files
committed
fix: use MediaIoBaseDownload for Google Play API binary downloads
- Replace direct execute() call with proper Google API media download - Add progress tracking during download - Use BytesIO buffer for binary data handling
1 parent 306caff commit 058d1ab

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,22 @@ jobs:
505505
output_filename = f"v2er-{os.environ['VERSION_NAME']}_google_play_signed.apk"
506506
507507
# Execute the download request and save to file
508+
# Use media download with googleapiclient.http to handle binary content
509+
import io
510+
from googleapiclient.http import MediaIoBaseDownload
511+
512+
file_io = io.BytesIO()
513+
downloader = MediaIoBaseDownload(file_io, download_request)
514+
515+
done = False
516+
while done is False:
517+
status, done = downloader.next_chunk()
518+
if status:
519+
print(f"Download progress: {int(status.progress() * 100)}%")
520+
521+
# Write to file
508522
with open(output_filename, 'wb') as f:
509-
download_request.execute(f)
523+
f.write(file_io.getvalue())
510524
511525
print(f"Successfully downloaded: {output_filename}")
512526
print(f"apk_path={output_filename}")

0 commit comments

Comments
 (0)