hippius 0.2.31__py3-none-any.whl → 0.2.32__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hippius
3
- Version: 0.2.31
3
+ Version: 0.2.32
4
4
  Summary: Python SDK and CLI for Hippius blockchain storage
5
5
  Home-page: https://github.com/thenervelab/hippius-sdk
6
6
  Author: Dubs
@@ -1,4 +1,4 @@
1
- hippius_sdk/__init__.py,sha256=WbUi_qWThtsE2iOxnESzEe-W-1kfFhaNVA0exKlHQUY,1474
1
+ hippius_sdk/__init__.py,sha256=8FFxrpAn61D-ViCK1aikqZ6-5TLbGt1T4kTHygQ1nfA,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
3
  hippius_sdk/cli_assets.py,sha256=V3MX63QTiex6mCp0VDXQJ7cagm5v1s4xtsu8c1O4G_k,371
4
4
  hippius_sdk/cli_handlers.py,sha256=TQNE9os87gRzRKLEO-SIwhFnBtEFMiaSESv-Bu7omfo,128909
@@ -13,12 +13,12 @@ hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql,sha
13
13
  hippius_sdk/db/setup_database.sh,sha256=bDeIiTnMuX0AYCdefAfEI1CyXho6A6kLzufsDZFSXpE,3118
14
14
  hippius_sdk/db_utils.py,sha256=-x0rbN0as7Tn3PJPZBYCgreZe52FLH40ppA1TLxsg90,1851
15
15
  hippius_sdk/errors.py,sha256=LScJJmawVAx7aRzqqQguYSkf9iazSjEQEBNlD_GXZ6Y,1589
16
- hippius_sdk/ipfs.py,sha256=L77kgDDPDZG12FcpweGvh9XRljP3VY7mITz4eAOoeX0,94699
16
+ hippius_sdk/ipfs.py,sha256=1kjWAMeGMAn8vpIrrpjAxTHvnCwruhFtWjQ18iGXSU8,95383
17
17
  hippius_sdk/ipfs_core.py,sha256=eOOgLoyP9mvwndnCjldnTc7z94ImYCXY3nm7JU3e_Mo,12676
18
18
  hippius_sdk/key_storage.py,sha256=SXFd6aGQw9MDLGX2vSBuAY7rdX-k5EvFm63z7_n-8yQ,8148
19
19
  hippius_sdk/substrate.py,sha256=MFQcJARFw-Ej1WDSPGF8ryejXLmda5DdqcwPYS-KI10,49668
20
20
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
21
- hippius-0.2.31.dist-info/METADATA,sha256=aOLz9F4ajZl3BJn2kubB0qTfUty3HJuOWv-fCk58QXU,30088
22
- hippius-0.2.31.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
- hippius-0.2.31.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
- hippius-0.2.31.dist-info/RECORD,,
21
+ hippius-0.2.32.dist-info/METADATA,sha256=8nDrlRkci7_eTNeKFQKsn2VDsQVSuAnT6esx9NVYyg8,30088
22
+ hippius-0.2.32.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
+ hippius-0.2.32.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
+ hippius-0.2.32.dist-info/RECORD,,
hippius_sdk/__init__.py CHANGED
@@ -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.31"
29
+ __version__ = "0.2.32"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
hippius_sdk/ipfs.py CHANGED
@@ -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
- try:
1717
- await self.client.unpin(link_hash)
1718
- print(
1719
- f"Unpinned file: {link_name} (CID: {link_hash})"
1720
- )
1721
- except Exception as unpin_error:
1722
- # Just note the error but don't let it stop the whole process
1723
- # This is common with IPFS servers that may return 500 errors for
1724
- # unpinning content that was never explicitly pinned
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"Note: Could not unpin {link_name}: {str(unpin_error).split('For more information')[0]}"
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
- try:
1741
- print(f"Unpinning from IPFS: {cid}")
1742
- unpin_result = await self.client.unpin(cid)
1743
- result["unpin_result"] = unpin_result
1744
- result["success"] = True
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
- else:
1757
- print(
1758
- f"Warning: Failed to unpin from IPFS: {error_str.split('For more information')[0]}"
1759
- )
1760
- result["success"] = False
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: