hippius 0.2.31__tar.gz → 0.2.32__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.
- {hippius-0.2.31 → hippius-0.2.32}/PKG-INFO +1 -1
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/__init__.py +1 -1
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/ipfs.py +43 -31
- {hippius-0.2.31 → hippius-0.2.32}/pyproject.toml +1 -1
- {hippius-0.2.31 → hippius-0.2.32}/README.md +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/cli.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/cli_assets.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/cli_handlers.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/cli_parser.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/cli_rich.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/client.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/config.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db/README.md +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db/env.db.template +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db/setup_database.sh +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/db_utils.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/errors.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/ipfs_core.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/key_storage.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/substrate.py +0 -0
- {hippius-0.2.31 → hippius-0.2.32}/hippius_sdk/utils.py +0 -0
@@ -26,7 +26,7 @@ from hippius_sdk.config import (
|
|
26
26
|
from hippius_sdk.ipfs import IPFSClient, S3PublishResult, S3DownloadResult
|
27
27
|
from hippius_sdk.utils import format_cid, format_size, hex_to_ipfs_cid
|
28
28
|
|
29
|
-
__version__ = "0.2.
|
29
|
+
__version__ = "0.2.32"
|
30
30
|
__all__ = [
|
31
31
|
"HippiusClient",
|
32
32
|
"IPFSClient",
|
@@ -1648,6 +1648,7 @@ class IPFSClient:
|
|
1648
1648
|
self,
|
1649
1649
|
cid: str,
|
1650
1650
|
cancel_from_blockchain: bool = True,
|
1651
|
+
unpin: bool = True,
|
1651
1652
|
seed_phrase: Optional[str] = None,
|
1652
1653
|
) -> Dict[str, Any]:
|
1653
1654
|
"""
|
@@ -1657,6 +1658,7 @@ class IPFSClient:
|
|
1657
1658
|
Args:
|
1658
1659
|
cid: Content Identifier (CID) of the file/directory to delete
|
1659
1660
|
cancel_from_blockchain: Whether to also cancel the storage request from the blockchain
|
1661
|
+
unpin: Whether to unpin the file from IPFS (default: True)
|
1660
1662
|
seed_phrase: Optional seed phrase to use for blockchain interactions (uses config if None)
|
1661
1663
|
|
1662
1664
|
Returns:
|
@@ -1709,21 +1711,26 @@ class IPFSClient:
|
|
1709
1711
|
):
|
1710
1712
|
# Recursive delete, but don't cancel from blockchain (we'll do that for parent)
|
1711
1713
|
await self.delete_file(
|
1712
|
-
link_hash, cancel_from_blockchain=False
|
1714
|
+
link_hash, cancel_from_blockchain=False, unpin=unpin
|
1713
1715
|
)
|
1714
1716
|
else:
|
1715
1717
|
# Regular file unpin
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1718
|
+
if unpin:
|
1719
|
+
try:
|
1720
|
+
await self.client.unpin(link_hash)
|
1721
|
+
print(
|
1722
|
+
f"Unpinned file: {link_name} (CID: {link_hash})"
|
1723
|
+
)
|
1724
|
+
except Exception as unpin_error:
|
1725
|
+
# Just note the error but don't let it stop the whole process
|
1726
|
+
# This is common with IPFS servers that may return 500 errors for
|
1727
|
+
# unpinning content that was never explicitly pinned
|
1728
|
+
print(
|
1729
|
+
f"Note: Could not unpin {link_name}: {str(unpin_error).split('For more information')[0]}"
|
1730
|
+
)
|
1731
|
+
else:
|
1725
1732
|
print(
|
1726
|
-
f"
|
1733
|
+
f"Skipped unpinning file: {link_name} (CID: {link_hash})"
|
1727
1734
|
)
|
1728
1735
|
except Exception as e:
|
1729
1736
|
print(
|
@@ -1737,27 +1744,32 @@ class IPFSClient:
|
|
1737
1744
|
# Continue with regular file unpin
|
1738
1745
|
|
1739
1746
|
# Now unpin the main file/directory
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
print("Successfully unpinned from IPFS")
|
1746
|
-
except Exception as e:
|
1747
|
-
# Handle 500 errors from IPFS server gracefully - they often occur
|
1748
|
-
# when the content wasn't explicitly pinned or was already unpinned
|
1749
|
-
error_str = str(e)
|
1750
|
-
if "500 Internal Server Error" in error_str:
|
1751
|
-
print(
|
1752
|
-
f"Note: IPFS server reported content may already be unpinned: {cid}"
|
1753
|
-
)
|
1754
|
-
result["unpin_result"] = {"Pins": [cid]} # Simulate successful unpin
|
1747
|
+
if unpin:
|
1748
|
+
try:
|
1749
|
+
print(f"Unpinning from IPFS: {cid}")
|
1750
|
+
unpin_result = await self.client.unpin(cid)
|
1751
|
+
result["unpin_result"] = unpin_result
|
1755
1752
|
result["success"] = True
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1753
|
+
print("Successfully unpinned from IPFS")
|
1754
|
+
except Exception as e:
|
1755
|
+
# Handle 500 errors from IPFS server gracefully - they often occur
|
1756
|
+
# when the content wasn't explicitly pinned or was already unpinned
|
1757
|
+
error_str = str(e)
|
1758
|
+
if "500 Internal Server Error" in error_str:
|
1759
|
+
print(
|
1760
|
+
f"Note: IPFS server reported content may already be unpinned: {cid}"
|
1761
|
+
)
|
1762
|
+
result["unpin_result"] = {"Pins": [cid]} # Simulate successful unpin
|
1763
|
+
result["success"] = True
|
1764
|
+
else:
|
1765
|
+
print(
|
1766
|
+
f"Warning: Failed to unpin from IPFS: {error_str.split('For more information')[0]}"
|
1767
|
+
)
|
1768
|
+
result["success"] = False
|
1769
|
+
else:
|
1770
|
+
print(f"Skipped unpinning from IPFS: {cid}")
|
1771
|
+
result["unpin_result"] = {"skipped": True}
|
1772
|
+
result["success"] = True
|
1761
1773
|
|
1762
1774
|
# Then, if requested, cancel from blockchain
|
1763
1775
|
if cancel_from_blockchain:
|
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
|