wallet: adding api_key configuration
Signed-off-by: Alexis Pentori <alexis@status.im>
This commit is contained in:
parent
083fa2d6a7
commit
7315c8d734
|
@ -10,7 +10,7 @@ data:
|
||||||
connectorSubtype: api
|
connectorSubtype: api
|
||||||
connectorType: source
|
connectorType: source
|
||||||
definitionId: 1e55cfe0-f591-4281-9a20-18d89d45f685
|
definitionId: 1e55cfe0-f591-4281-9a20-18d89d45f685
|
||||||
dockerImageTag: 0.9.1
|
dockerImageTag: 1.0.1
|
||||||
dockerRepository: status-im/airbyte/wallet-fetcher
|
dockerRepository: status-im/airbyte/wallet-fetcher
|
||||||
githubIssueLabel: source-wallet-fetcher
|
githubIssueLabel: source-wallet-fetcher
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
|
|
|
@ -24,7 +24,9 @@ class SourceWalletFetcher(AbstractSource):
|
||||||
bitcoin_wallets.append(wallet)
|
bitcoin_wallets.append(wallet)
|
||||||
if 'ETH' in wallet['blockchain']:
|
if 'ETH' in wallet['blockchain']:
|
||||||
ethereum_wallets.append(wallet)
|
ethereum_wallets.append(wallet)
|
||||||
|
api_key='freekey'
|
||||||
|
if "api_key" in config:
|
||||||
|
api_key=config["api_key"]
|
||||||
return [
|
return [
|
||||||
BitcoinToken(wallets=bitcoin_wallets),
|
BitcoinToken(wallets=bitcoin_wallets),
|
||||||
EthereumToken(wallets=ethereum_wallets)]
|
EthereumToken(wallets=ethereum_wallets, api_key=api_key)]
|
||||||
|
|
|
@ -7,6 +7,11 @@ connectionSpecification:
|
||||||
- wallets
|
- wallets
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
properties:
|
properties:
|
||||||
|
api_key:
|
||||||
|
title: api_key
|
||||||
|
type: string
|
||||||
|
description: 'API key for ethplorer'
|
||||||
|
airbyte_secret: true
|
||||||
wallets:
|
wallets:
|
||||||
title: Wallets
|
title: Wallets
|
||||||
description: "List of wallet to scan"
|
description: "List of wallet to scan"
|
||||||
|
|
|
@ -13,9 +13,10 @@ class BlockchainStream(HttpStream):
|
||||||
primary_key = None
|
primary_key = None
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, wallets: List['str'], **kwargs):
|
def __init__(self, wallets: List['str'], api_key: str='freekey', **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.wallets = wallets
|
self.wallets = wallets
|
||||||
|
self.api_key = api_key
|
||||||
|
|
||||||
def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
|
def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
|
||||||
for wallet in self.wallets:
|
for wallet in self.wallets:
|
||||||
|
@ -74,7 +75,7 @@ class EthereumToken(BlockchainStream):
|
||||||
url_base = "https://api.ethplorer.io/getAddressInfo/"
|
url_base = "https://api.ethplorer.io/getAddressInfo/"
|
||||||
|
|
||||||
def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
|
def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
|
||||||
return f"{stream_slice['address']}?apiKey=freekey"
|
return f"{stream_slice['address']}?apiKey={self.api_key}"
|
||||||
|
|
||||||
def parse_response(self,
|
def parse_response(self,
|
||||||
response: requests.Response,
|
response: requests.Response,
|
||||||
|
|
Loading…
Reference in New Issue