hippius 0.2.4__py3-none-any.whl → 0.2.6__py3-none-any.whl
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.
- {hippius-0.2.4.dist-info → hippius-0.2.6.dist-info}/METADATA +1 -1
- hippius-0.2.6.dist-info/RECORD +17 -0
- hippius_sdk/__init__.py +21 -10
- hippius_sdk/cli.py +12 -0
- hippius_sdk/cli_handlers.py +413 -57
- hippius_sdk/cli_parser.py +20 -0
- hippius_sdk/cli_rich.py +8 -2
- hippius_sdk/client.py +5 -3
- hippius_sdk/errors.py +77 -0
- hippius_sdk/ipfs.py +249 -298
- hippius_sdk/ipfs_core.py +216 -10
- hippius_sdk/substrate.py +101 -14
- hippius-0.2.4.dist-info/RECORD +0 -16
- {hippius-0.2.4.dist-info → hippius-0.2.6.dist-info}/WHEEL +0 -0
- {hippius-0.2.4.dist-info → hippius-0.2.6.dist-info}/entry_points.txt +0 -0
hippius_sdk/cli_rich.py
CHANGED
@@ -6,8 +6,14 @@ from typing import Any, Dict, List, Optional, Union
|
|
6
6
|
|
7
7
|
from rich.console import Console
|
8
8
|
from rich.panel import Panel
|
9
|
-
from rich.progress import (
|
10
|
-
|
9
|
+
from rich.progress import (
|
10
|
+
BarColumn,
|
11
|
+
Progress,
|
12
|
+
SpinnerColumn,
|
13
|
+
TextColumn,
|
14
|
+
TimeElapsedColumn,
|
15
|
+
TimeRemainingColumn,
|
16
|
+
)
|
11
17
|
from rich.table import Table
|
12
18
|
from rich.text import Text
|
13
19
|
|
hippius_sdk/client.py
CHANGED
@@ -148,10 +148,11 @@ class HippiusClient:
|
|
148
148
|
) -> Dict[str, Any]:
|
149
149
|
"""
|
150
150
|
Download a file from IPFS with optional decryption.
|
151
|
+
Supports downloading directories - in that case, a directory structure will be created.
|
151
152
|
|
152
153
|
Args:
|
153
154
|
cid: Content Identifier (CID) of the file to download
|
154
|
-
output_path: Path where the downloaded file will be saved
|
155
|
+
output_path: Path where the downloaded file/directory will be saved
|
155
156
|
decrypt: Whether to decrypt the file (overrides default)
|
156
157
|
|
157
158
|
Returns:
|
@@ -162,6 +163,7 @@ class HippiusClient:
|
|
162
163
|
- size_formatted: Human-readable file size
|
163
164
|
- elapsed_seconds: Time taken for the download
|
164
165
|
- decrypted: Whether the file was decrypted
|
166
|
+
- is_directory: Whether the download was a directory
|
165
167
|
|
166
168
|
Raises:
|
167
169
|
requests.RequestException: If the download fails
|
@@ -436,7 +438,7 @@ class HippiusClient:
|
|
436
438
|
metadata_cid: str,
|
437
439
|
cancel_from_blockchain: bool = True,
|
438
440
|
parallel_limit: int = 20,
|
439
|
-
) ->
|
441
|
+
) -> bool:
|
440
442
|
"""
|
441
443
|
Delete an erasure-coded file, including all its chunks in parallel.
|
442
444
|
|
@@ -446,7 +448,7 @@ class HippiusClient:
|
|
446
448
|
parallel_limit: Maximum number of concurrent deletion operations
|
447
449
|
|
448
450
|
Returns:
|
449
|
-
|
451
|
+
True or false if failed.
|
450
452
|
|
451
453
|
Raises:
|
452
454
|
RuntimeError: If deletion fails completely
|
hippius_sdk/errors.py
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
"""
|
2
|
+
Custom exceptions for the Hippius SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
class HippiusError(Exception):
|
7
|
+
"""Base exception for all Hippius-specific errors."""
|
8
|
+
|
9
|
+
pass
|
10
|
+
|
11
|
+
|
12
|
+
class HippiusSubstrateError(HippiusError):
|
13
|
+
"""Base exception for Substrate-related errors."""
|
14
|
+
|
15
|
+
pass
|
16
|
+
|
17
|
+
|
18
|
+
class HippiusIPFSError(HippiusError):
|
19
|
+
"""Base exception for IPFS-related errors."""
|
20
|
+
|
21
|
+
pass
|
22
|
+
|
23
|
+
|
24
|
+
# Specific blockchain errors
|
25
|
+
class HippiusNotFoundError(HippiusSubstrateError):
|
26
|
+
"""Raised when a resource is not found on the blockchain."""
|
27
|
+
|
28
|
+
pass
|
29
|
+
|
30
|
+
|
31
|
+
class HippiusAlreadyDeletedError(HippiusSubstrateError):
|
32
|
+
"""Raised when trying to delete a file that's already deleted from the blockchain."""
|
33
|
+
|
34
|
+
pass
|
35
|
+
|
36
|
+
|
37
|
+
class HippiusSubstrateConnectionError(HippiusSubstrateError):
|
38
|
+
"""Raised when there's an issue connecting to the Substrate node."""
|
39
|
+
|
40
|
+
pass
|
41
|
+
|
42
|
+
|
43
|
+
class HippiusSubstrateAuthError(HippiusSubstrateError):
|
44
|
+
"""Raised when there's an authentication issue with the Substrate client."""
|
45
|
+
|
46
|
+
pass
|
47
|
+
|
48
|
+
|
49
|
+
class HippiusFailedSubstrateDelete(HippiusSubstrateError):
|
50
|
+
"""Raised when deletion from blockchain storage fails."""
|
51
|
+
|
52
|
+
pass
|
53
|
+
|
54
|
+
|
55
|
+
# IPFS-specific errors
|
56
|
+
class HippiusIPFSConnectionError(HippiusIPFSError):
|
57
|
+
"""Raised when there's an issue connecting to IPFS."""
|
58
|
+
|
59
|
+
pass
|
60
|
+
|
61
|
+
|
62
|
+
class HippiusFailedIPFSUnpin(HippiusIPFSError):
|
63
|
+
"""Raised when unpinning from IPFS fails."""
|
64
|
+
|
65
|
+
pass
|
66
|
+
|
67
|
+
|
68
|
+
class HippiusMetadataError(HippiusIPFSError):
|
69
|
+
"""Raised when there's an issue with the metadata file."""
|
70
|
+
|
71
|
+
pass
|
72
|
+
|
73
|
+
|
74
|
+
class HippiusInvalidCIDError(HippiusIPFSError):
|
75
|
+
"""Raised when an invalid CID is provided."""
|
76
|
+
|
77
|
+
pass
|