mirror of
https://github.com/status-im/airbyte-custom-connector.git
synced 2025-02-17 03:16:36 +00:00
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
|
||||
connectorType: source
|
||||
definitionId: 1e55cfe0-f591-4281-9a20-18d89d45f685
|
||||
dockerImageTag: 0.9.1
|
||||
dockerImageTag: 1.0.1
|
||||
dockerRepository: status-im/airbyte/wallet-fetcher
|
||||
githubIssueLabel: source-wallet-fetcher
|
||||
icon: icon.svg
|
||||
|
@ -24,7 +24,9 @@ class SourceWalletFetcher(AbstractSource):
|
||||
bitcoin_wallets.append(wallet)
|
||||
if 'ETH' in wallet['blockchain']:
|
||||
ethereum_wallets.append(wallet)
|
||||
|
||||
api_key='freekey'
|
||||
if "api_key" in config:
|
||||
api_key=config["api_key"]
|
||||
return [
|
||||
BitcoinToken(wallets=bitcoin_wallets),
|
||||
EthereumToken(wallets=ethereum_wallets)]
|
||||
EthereumToken(wallets=ethereum_wallets, api_key=api_key)]
|
||||
|
@ -7,6 +7,11 @@ connectionSpecification:
|
||||
- wallets
|
||||
additionalProperties: true
|
||||
properties:
|
||||
api_key:
|
||||
title: api_key
|
||||
type: string
|
||||
description: 'API key for ethplorer'
|
||||
airbyte_secret: true
|
||||
wallets:
|
||||
title: Wallets
|
||||
description: "List of wallet to scan"
|
||||
|
@ -13,9 +13,10 @@ class BlockchainStream(HttpStream):
|
||||
primary_key = None
|
||||
|
||||
|
||||
def __init__(self, wallets: List['str'], **kwargs):
|
||||
def __init__(self, wallets: List['str'], api_key: str='freekey', **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.wallets = wallets
|
||||
self.api_key = api_key
|
||||
|
||||
def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
|
||||
for wallet in self.wallets:
|
||||
@ -74,7 +75,7 @@ class EthereumToken(BlockchainStream):
|
||||
url_base = "https://api.ethplorer.io/getAddressInfo/"
|
||||
|
||||
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,
|
||||
response: requests.Response,
|
||||
|
Loading…
x
Reference in New Issue
Block a user