hippius 0.2.42__py3-none-any.whl → 0.2.44__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.42
3
+ Version: 0.2.44
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=69XR6atYPkJPYLkUd6NHE15X_4eNNnaKQAy9yIGA4dc,1474
1
+ hippius_sdk/__init__.py,sha256=mk5TY1tFuEOZimiH4ju6fTc0ug3fw_oVhK-sEmVfSV4,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
3
  hippius_sdk/cli_assets.py,sha256=rjH3Z5A1CQr2d5CIAAAb0WMCjoZZlMWcdo0f93KqluE,635
4
4
  hippius_sdk/cli_handlers.py,sha256=HkZldE8ZDS6WHu8aSoeS_rYZ4kp3F-Kdzu-weY1c0vU,128258
@@ -13,12 +13,12 @@ hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql,sha
13
13
  hippius_sdk/db/setup_database.sh,sha256=STp03qxkp2RmIVr6YZIcvQQm-_LLUOb6Jobh-52HWmg,3115
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=CpVSEKVrHrZAXrhJsCPPZcADSx2tpE_ktA1TLlMiUQc,103749
17
- hippius_sdk/ipfs_core.py,sha256=WG7bGLk-threOvmumizwh1dnd5zqbIkTXy1y-BRGayI,12789
16
+ hippius_sdk/ipfs.py,sha256=los32BjKuVMX9v4GWT-mXUQuxAm2Quc8GjKOMqH42LU,103808
17
+ hippius_sdk/ipfs_core.py,sha256=0gzR5zucWoetrKb_bG0O9inGiZxHfuWvFeDMv8qrCi4,13108
18
18
  hippius_sdk/key_storage.py,sha256=SXFd6aGQw9MDLGX2vSBuAY7rdX-k5EvFm63z7_n-8yQ,8148
19
19
  hippius_sdk/substrate.py,sha256=4a7UIE4UqGcDW7luKTBgSDqfb2OIZusB39G1UiRs_YU,50158
20
20
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
21
- hippius-0.2.42.dist-info/METADATA,sha256=kSv4QdslPlxwgECpO3_UAq8-CAQGhtK8JEZ-zi7xKgU,30088
22
- hippius-0.2.42.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
- hippius-0.2.42.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
- hippius-0.2.42.dist-info/RECORD,,
21
+ hippius-0.2.44.dist-info/METADATA,sha256=JKOmVfvlchci0FLqYagWtn7v9isPoTJVhbZrBD9aAHU,30088
22
+ hippius-0.2.44.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
+ hippius-0.2.44.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
+ hippius-0.2.44.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.42"
29
+ __version__ = "0.2.44"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
hippius_sdk/ipfs.py CHANGED
@@ -2114,7 +2114,7 @@ class IPFSClient:
2114
2114
  except Exception as e:
2115
2115
  raise HippiusIPFSError(
2116
2116
  f"Failed to upload content to store node {store_node}: {str(e)}"
2117
- )
2117
+ ) from e
2118
2118
 
2119
2119
  # Step 2: Pin to pin_node (remote) for persistence and backup
2120
2120
  try:
@@ -2124,7 +2124,7 @@ class IPFSClient:
2124
2124
  except Exception as e:
2125
2125
  raise HippiusIPFSError(
2126
2126
  f"Failed to pin content to pin node {pin_node}: {str(e)}"
2127
- )
2127
+ ) from e
2128
2128
 
2129
2129
  # Conditionally publish to substrate marketplace based on publish flag
2130
2130
  if publish:
@@ -2167,7 +2167,9 @@ class IPFSClient:
2167
2167
  logger.debug(
2168
2168
  "Possible causes: insufficient credits, network issues, invalid seed phrase, or substrate node unavailability"
2169
2169
  )
2170
- raise HippiusSubstrateError(f"Failed to publish to substrate: {str(e)}")
2170
+ raise HippiusSubstrateError(
2171
+ f"Failed to publish to substrate: {str(e)}"
2172
+ ) from e
2171
2173
 
2172
2174
  return S3PublishResult(
2173
2175
  cid=cid,
hippius_sdk/ipfs_core.py CHANGED
@@ -1,9 +1,13 @@
1
1
  import json
2
+ import logging
2
3
  import os
4
+ from json import JSONDecodeError
3
5
  from typing import Any, Dict
4
6
 
5
7
  import httpx
6
8
 
9
+ logger = logging.getLogger(__name__)
10
+
7
11
 
8
12
  class AsyncIPFSClient:
9
13
  """
@@ -89,13 +93,20 @@ class AsyncIPFSClient:
89
93
  """
90
94
  # Specify file with name and content type to ensure consistent handling
91
95
  files = {"file": (filename, data, "application/octet-stream")}
96
+ url = f"{self.api_url}/api/v0/add?wrap-with-directory=false&cid-version=1"
92
97
  # Explicitly set wrap-with-directory=false to prevent wrapping in directory
93
98
  response = await self.client.post(
94
- f"{self.api_url}/api/v0/add?wrap-with-directory=false&cid-version=1",
99
+ url,
95
100
  files=files,
96
101
  )
97
102
  response.raise_for_status()
98
- return response.json()
103
+ try:
104
+ return response.json()
105
+ except JSONDecodeError:
106
+ logger.warning(
107
+ f"Corrupted response returned from {url=} {filename=} ({len(data)=}) {response.content=}"
108
+ )
109
+ raise
99
110
 
100
111
  async def add_str(self, content: str, filename: str = "file") -> Dict[str, Any]:
101
112
  """