diff --git a/requirements.txt b/requirements.txt index 1159ddd..52e25d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -requests==2.31.0 backoff==2.2.1 -tqdm==4.66.1 +requests==2.31.0 +requests-toolbelt==1.0.0 +tqdm==4.66.1 \ No newline at end of file diff --git a/setup.py b/setup.py index db2f955..dc08019 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ "requests>=2.25.1", "backoff>=2.2.1", "tqdm>=4.66.1", + "requests-toolbelt==1.0.0", ], classifiers=[ "Intended Audience :: Developers", diff --git a/videodb/_upload.py b/videodb/_upload.py index 90f7b46..33212c6 100644 --- a/videodb/_upload.py +++ b/videodb/_upload.py @@ -2,7 +2,7 @@ from typing import Optional from requests import HTTPError - +from requests_toolbelt.multipart.encoder import MultipartEncoder from videodb._constants import ( ApiPath, @@ -36,9 +36,12 @@ def upload( ) upload_url = upload_url_data.get("upload_url") with open(file_path, "rb") as file: - files = {"file": (name, file)} - response = requests.post(upload_url, files=files) - response.raise_for_status() + encoder = MultipartEncoder(fields={"file": (name, file)}) + headers = {"Content-Type": encoder.content_type} + with requests.post( + upload_url, data=encoder, headers=headers + ) as response: + response.raise_for_status() url = upload_url except FileNotFoundError as e: diff --git a/videodb/video.py b/videodb/video.py index e006a39..2102d1f 100644 --- a/videodb/video.py +++ b/videodb/video.py @@ -329,6 +329,8 @@ def list_scene_index(self) -> List: return index_data.get("scene_indexes", []) def get_scene_index(self, scene_index_id: str) -> Optional[List]: + if not scene_index_id: + raise ValueError("scene_index_id is required") index_data = self._connection.get( path=f"{ApiPath.video}/{self.id}/{ApiPath.index}/{ApiPath.scene}/{scene_index_id}" )
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: