mirror of
https://github.com/arabianq/viking-file-python.git
synced 2026-04-28 06:21:24 +00:00
fix: timeout while uploading remote files
version -> 1.0.3
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "viking-file"
|
name = "viking-file"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
description = "API Wrapper for ViKiNG FiLE API (https://vikingfile.com)"
|
description = "API Wrapper for ViKiNG FiLE API (https://vikingfile.com)"
|
||||||
authors = [{ name = "arabianq", email = "a.tevg@ya.ru" }]
|
authors = [{ name = "arabianq", email = "a.tevg@ya.ru" }]
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "viking-file"
|
name = "viking-file"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiofiles" },
|
{ name = "aiofiles" },
|
||||||
|
|||||||
@@ -358,19 +358,21 @@ class AsyncVikingClient:
|
|||||||
)
|
)
|
||||||
api_response.raise_for_status()
|
api_response.raise_for_status()
|
||||||
|
|
||||||
api_response_text = await api_response.text()
|
async for line in api_response.content:
|
||||||
try:
|
line = line.strip()
|
||||||
api_response_lines = api_response_text.split("\n")
|
line_json = json.loads(line)
|
||||||
api_response_last_line = api_response_lines[-1].strip()
|
|
||||||
api_response_json = json.loads(api_response_last_line)
|
if line_json.get("progress"):
|
||||||
|
continue
|
||||||
|
|
||||||
return File(
|
return File(
|
||||||
hash=api_response_json.get("hash"),
|
hash=line_json.get("hash"),
|
||||||
name=api_response_json.get("name"),
|
name=line_json.get("name"),
|
||||||
size=api_response_json.get("size"),
|
size=line_json.get("size"),
|
||||||
|
downloads=0
|
||||||
)
|
)
|
||||||
except Exception as _e:
|
|
||||||
raise ApiException(api_response_text)
|
raise ApiException(await api_response.text())
|
||||||
|
|
||||||
@deprecated("Use upload_file instead", category=None)
|
@deprecated("Use upload_file instead", category=None)
|
||||||
async def upload_file_legacy(self, filepath: Path | str, path: str = ""):
|
async def upload_file_legacy(self, filepath: Path | str, path: str = ""):
|
||||||
|
|||||||
Reference in New Issue
Block a user