python-dropbox-api 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/PKG-INFO +2 -1
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/pyproject.toml +1 -1
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/client.py +14 -2
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/LICENSE +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/README.md +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/__init__.py +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/auth.py +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/exceptions.py +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/models.py +0 -0
- {python_dropbox_api-0.1.4 → python_dropbox_api-0.1.5}/python_dropbox_api/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-dropbox-api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: This is a lightweight wrapper for the Dropbox API intended for use in Home Assistant.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -10,6 +10,7 @@ Requires-Python: >=3.13
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
13
14
|
Requires-Dist: aiohttp (>=3.13.0,<4.0.0)
|
|
14
15
|
Description-Content-Type: text/markdown
|
|
15
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-dropbox-api"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.5"
|
|
4
4
|
description = "This is a lightweight wrapper for the Dropbox API intended for use in Home Assistant."
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Brandon Rothweiler",email = "2292715+bdr99@users.noreply.github.com"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from collections.abc import AsyncIterator
|
|
1
|
+
from collections.abc import AsyncIterator, Callable
|
|
2
2
|
import json
|
|
3
3
|
|
|
4
4
|
from aiohttp import ClientResponse
|
|
@@ -238,6 +238,7 @@ class DropboxAPIClient:
|
|
|
238
238
|
path: str,
|
|
239
239
|
file_stream: AsyncIterator[bytes],
|
|
240
240
|
property_groups: list[PropertyGroup] | None = None,
|
|
241
|
+
progress_callback: Callable[[int], None] | None = None,
|
|
241
242
|
) -> None:
|
|
242
243
|
"""Upload a file to Dropbox using chunked upload sessions.
|
|
243
244
|
|
|
@@ -245,13 +246,19 @@ class DropboxAPIClient:
|
|
|
245
246
|
path: The Dropbox path where the file should be uploaded.
|
|
246
247
|
file_stream: An async iterator of bytes to upload.
|
|
247
248
|
property_groups: Optional list of property groups to attach to the uploaded file.
|
|
249
|
+
progress_callback: Optional callback called with the total number of bytes uploaded after each chunk is sent.
|
|
248
250
|
"""
|
|
249
251
|
try:
|
|
250
252
|
CHUNK_SIZE = 16 * 1024 * 1024 # 16MB chunks
|
|
251
253
|
|
|
252
254
|
# Always use chunked upload approach
|
|
253
255
|
await self._upload_file_chunked(
|
|
254
|
-
CONTENT_API_BASE_URL,
|
|
256
|
+
CONTENT_API_BASE_URL,
|
|
257
|
+
path,
|
|
258
|
+
file_stream,
|
|
259
|
+
CHUNK_SIZE,
|
|
260
|
+
property_groups,
|
|
261
|
+
progress_callback,
|
|
255
262
|
)
|
|
256
263
|
except (DropboxAuthException, DropboxFileOrFolderNotFoundException):
|
|
257
264
|
raise
|
|
@@ -265,6 +272,7 @@ class DropboxAPIClient:
|
|
|
265
272
|
file_stream: AsyncIterator[bytes],
|
|
266
273
|
chunk_size: int,
|
|
267
274
|
property_groups: list[PropertyGroup] | None = None,
|
|
275
|
+
progress_callback: Callable[[int], None] | None = None,
|
|
268
276
|
) -> None:
|
|
269
277
|
"""Upload a file using chunked upload sessions, streaming chunks without loading entire file into memory."""
|
|
270
278
|
session_id = None
|
|
@@ -295,6 +303,8 @@ class DropboxAPIClient:
|
|
|
295
303
|
)
|
|
296
304
|
|
|
297
305
|
offset += len(chunk_data)
|
|
306
|
+
if progress_callback:
|
|
307
|
+
progress_callback(offset)
|
|
298
308
|
|
|
299
309
|
# Handle remaining data in buffer (final partial chunk)
|
|
300
310
|
if buffer:
|
|
@@ -307,6 +317,8 @@ class DropboxAPIClient:
|
|
|
307
317
|
content_api_url, session_id, offset, buffer
|
|
308
318
|
)
|
|
309
319
|
offset += len(buffer)
|
|
320
|
+
if progress_callback:
|
|
321
|
+
progress_callback(offset)
|
|
310
322
|
|
|
311
323
|
# Empty file (or a stream that yielded no bytes): no session was ever
|
|
312
324
|
# started, so open one with no data before finishing.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|