sciop-cli 0.2.0__tar.gz → 0.2.2__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.
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/PKG-INFO +1 -1
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/pyproject.toml +1 -1
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/api.py +8 -4
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/api.py +2 -1
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/main.py +2 -1
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/config.py +2 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/LICENSE +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/README.md +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/__main__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/client.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/manifest.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/torrent.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/base.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/qbt.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/const.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/data.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/exceptions.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/models/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/models/sciop.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/schema.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/torrent.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/types.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/conftest.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic/part_1/subdir/part_1 +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic/part_2/subdir/part_2 +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic_hybrid.torrent +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic_v2.torrent +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/distributions/dlc_chrysler_ver02.json +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/distributions/nbu_arwen_ver01.json +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/base.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/fabricators.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_api.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/test_api.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/test_torrent.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_client/__init__.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_client/test_client_config.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_config.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_data.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_temp.py +0 -0
- {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_torrent.py +0 -0
|
@@ -226,7 +226,9 @@ def claim_next(dataset: str) -> DatasetClaim | None:
|
|
|
226
226
|
return DatasetClaim(**claim)
|
|
227
227
|
|
|
228
228
|
|
|
229
|
-
def upload_torrent(path: Path, timeout: float | None =
|
|
229
|
+
def upload_torrent(path: Path, timeout: float | None = None) -> TorrentFile:
|
|
230
|
+
if timeout is None:
|
|
231
|
+
timeout = get_config().upload_timeout
|
|
230
232
|
with open(path, "rb") as f:
|
|
231
233
|
response = api_call("torrents", files={"file": f}, timeout=timeout)
|
|
232
234
|
tf = cast(TorrentFile, response.json())
|
|
@@ -240,7 +242,7 @@ def create_upload(
|
|
|
240
242
|
infohash: str | None = None,
|
|
241
243
|
method: str | Path | None = None,
|
|
242
244
|
description: str | Path | None = None,
|
|
243
|
-
timeout: float | None =
|
|
245
|
+
timeout: float | None = None,
|
|
244
246
|
) -> Upload:
|
|
245
247
|
"""
|
|
246
248
|
Create an upload for a dataset or dataset parts.
|
|
@@ -259,8 +261,7 @@ def create_upload(
|
|
|
259
261
|
that are not contained within the dataset description, e.g. additional structure,
|
|
260
262
|
if this is some sub-component of a dataset, and so on
|
|
261
263
|
timeout (float | None): Timeout in seconds to wait for the upload to complete.
|
|
262
|
-
|
|
263
|
-
explicitly pass `None` to use `config.request_timeout`
|
|
264
|
+
If `None`, use Config.upload_timeout
|
|
264
265
|
"""
|
|
265
266
|
if torrent_path and infohash or not (torrent_path or infohash):
|
|
266
267
|
raise ValueError("Must pass torrent path OR infohash")
|
|
@@ -268,6 +269,9 @@ def create_upload(
|
|
|
268
269
|
tf = upload_torrent(path=torrent_path, timeout=timeout)
|
|
269
270
|
infohash = tf["v1_infohash"] if tf["version"] == "v1" else tf["v2_infohash"]
|
|
270
271
|
|
|
272
|
+
if timeout is None:
|
|
273
|
+
timeout = get_config().upload_timeout
|
|
274
|
+
|
|
271
275
|
kwargs: dict[str, str | list[str] | None] = {
|
|
272
276
|
"infohash": infohash,
|
|
273
277
|
"dataset_slug": dataset,
|
|
@@ -37,7 +37,7 @@ def login(username: str, password: str, instance_url: str | None = None) -> None
|
|
|
37
37
|
"--torrent",
|
|
38
38
|
help="Path to the torrent file to upload",
|
|
39
39
|
required=False,
|
|
40
|
-
type=click.Path(),
|
|
40
|
+
type=click.Path(exists=True, dir_okay=False, path_type=Path),
|
|
41
41
|
default=None,
|
|
42
42
|
)
|
|
43
43
|
@click.option(
|
|
@@ -80,6 +80,7 @@ def upload(
|
|
|
80
80
|
upload = create_upload(
|
|
81
81
|
dataset=dataset,
|
|
82
82
|
dataset_parts=part,
|
|
83
|
+
torrent_path=torrent,
|
|
83
84
|
infohash=infohash,
|
|
84
85
|
method=method,
|
|
85
86
|
description=description,
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
|
|
3
3
|
import click
|
|
4
4
|
|
|
5
|
-
from sciop_cli.cli.api import claims, login
|
|
5
|
+
from sciop_cli.cli.api import claims, login, upload
|
|
6
6
|
from sciop_cli.cli.client import client
|
|
7
7
|
from sciop_cli.cli.manifest import manifest
|
|
8
8
|
from sciop_cli.cli.torrent import torrent
|
|
@@ -24,6 +24,7 @@ def cli(debug: bool) -> None:
|
|
|
24
24
|
# top-level API commands
|
|
25
25
|
cli.add_command(login)
|
|
26
26
|
cli.add_command(claims)
|
|
27
|
+
cli.add_command(upload)
|
|
27
28
|
|
|
28
29
|
# command groups
|
|
29
30
|
cli.add_command(client)
|
|
@@ -67,6 +67,8 @@ class Config(BaseSettings):
|
|
|
67
67
|
password: KeychainSecretStr() = None # type: ignore[valid-type]
|
|
68
68
|
request_timeout: float = 5
|
|
69
69
|
"""Default timeout to use in API requests."""
|
|
70
|
+
upload_timeout: float = 300
|
|
71
|
+
"""Default timeout for file uploads in seconds"""
|
|
70
72
|
token: TokenSecretStr = None
|
|
71
73
|
"""Expiring jwt, stored in config to reuse between cli calls"""
|
|
72
74
|
clients: list[ClientConfigs] = Field(default_factory=list)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|