From 4a93ae87f49073bd9ce9164afa8d45a7c188455b Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:23:38 -0700 Subject: [PATCH] Fixes for Binary Uploads --- zipline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zipline.py b/zipline.py index 8855f51..8f244df 100644 --- a/zipline.py +++ b/zipline.py @@ -9,7 +9,7 @@ from decouple import config from dotenv import find_dotenv, load_dotenv from pathlib import Path -from typing import Any, Dict, List, Optional, TextIO +from typing import Any, Dict, List, Optional, TextIO, BinaryIO, Union class ZipURL(object): @@ -60,7 +60,7 @@ def __init__(self, base_url: str, **kwargs): key = header.replace('_', '-').title() self._headers[key] = str(value) - def send_file(self, file_name: str, file_object: TextIO, + def send_file(self, file_name: str, file_object: Union[BinaryIO, TextIO], overrides: Optional[dict] = None) -> ZipURL: """ Send File to Zipline @@ -198,7 +198,7 @@ def run() -> None: if not os.path.isfile(name): print(f'Warning: File Not Found: {name}') continue - with open(name) as f: + with open(name, 'rb') as f: # name, ext = os.path.splitext(os.path.basename(filename)) # ext = f'.{ext}' if ext else '' # name = f'{name}-{gen_rand(8)}{ext}'