Skip to content

Commit ab4094d

Browse files
committed
bump ver 0.2.3
1 parent dc4d015 commit ab4094d

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

ipfsApi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .client import *
44

55

6-
__version__ = '0.2.2'
6+
__version__ = '0.2.3'

ipfsApi/client.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from . import http, multipart, utils
77
from .commands import ArgCommand, Command, DownloadCommand, FileCommand
8-
8+
from .exceptions import ipfsApiError
99

1010
default_host = 'localhost'
1111
default_port = 5001
@@ -432,16 +432,22 @@ def dht_findpeer(self, *args, **kwargs):
432432
"""
433433
return self._dht_findpeer.request(self._client, *args, **kwargs)
434434

435-
@utils.return_field('Extra')
436435
def dht_get(self, *args, **kwargs):
437436
"""
438437
"""
439-
return self._dht_get.request(self._client, *args, **kwargs)
438+
res = self._dht_get.request(self._client, *args, **kwargs)
439+
if isinstance(res, dict) and "Extra" in res:
440+
return res["Extra"]
441+
else:
442+
for r in res:
443+
if "Extra" in r and len(r["Extra"]) > 0:
444+
return r["Extra"]
445+
raise ipfsApiError("empty response from DHT")
440446

441447
def dht_put(self, key, value, **kwargs):
442448
"""
443449
"""
444-
return self._dht_put.request(self._client, [key, value], **kwargs)
450+
return self._dht_put.request(self._client, key, value, **kwargs)
445451

446452
def ping(self, *args, **kwargs):
447453
"""

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Versions should comply with PEP440. For a discussion on single-sourcing
88
# the version across setup.py and the project code, see
99
# https://packaging.python.org/en/latest/single_source_version.html
10-
version='0.2.2',
10+
version='0.2.3',
1111

1212
description='IPFS API Bindings for Python',
1313

0 commit comments

Comments
 (0)