Skip to content

Commit 97ee8ca

Browse files
Fix ipfs datasource config (#225)
1 parent 24e7bc8 commit 97ee8ca

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Please use [this](https://docs.gitlab.com/ee/development/changelog.html) document as guidelines to keep a changelog.
44

5+
## 4.2.2 - 2022-02-01
6+
7+
### Fixed
8+
9+
* config: Fixed `ipfs` datasource config.
10+
511
## 4.2.1 - 2022-01-31
612

713
### Fixed

src/dipdup/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def valid_address(cls, v):
194194
return v
195195

196196

197-
# NOTE: Don't forget `http` in all datasource configs
197+
# NOTE: Don't forget `http` and `__hash__` in all datasource configs
198198
@dataclass
199199
class TzktDatasourceConfig(NameMixin):
200200
"""TzKT datasource config
@@ -287,12 +287,16 @@ class IpfsDatasourceConfig(NameMixin):
287287
url: str = DEFAULT_IPFS_URL
288288
http: Optional[HTTPConfig] = None
289289

290+
def __hash__(self):
291+
return hash(self.kind + self.url)
292+
290293

291294
DatasourceConfigT = Union[
292295
TzktDatasourceConfig,
293296
BcdDatasourceConfig,
294297
CoinbaseDatasourceConfig,
295298
MetadataDatasourceConfig,
299+
IpfsDatasourceConfig,
296300
]
297301

298302

src/dipdup/datasources/ipfs/datasource.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import logging
12
from typing import Any
3+
from typing import Optional
24

35
from dipdup.config import HTTPConfig
46
from dipdup.datasources.datasource import Datasource
@@ -9,6 +11,10 @@ class IpfsDatasource(Datasource):
911
retry_count=1,
1012
)
1113

14+
def __init__(self, url, http_config: Optional[HTTPConfig] = None) -> None:
15+
super().__init__(url, self._default_http_config.merge(http_config))
16+
self._logger = logging.getLogger('dipdup.ipfs')
17+
1218
async def run(self) -> None:
1319
pass
1420

0 commit comments

Comments
 (0)