Skip to content

Commit

Permalink
Defillama api key support (#84)
Browse files Browse the repository at this point in the history
* Defillama api key support

* fix: env

* fix: remove dotenv

---------

Co-authored-by: 0xevolve <[email protected]>
  • Loading branch information
JordyRo1 and EvolveArt authored Feb 27, 2024
1 parent 49065d4 commit 35ebdec
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pragma/publisher/fetchers/defillama.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import logging
import os
from typing import Dict, List

import requests
Expand Down Expand Up @@ -46,15 +47,18 @@ class DefillamaFetcher(PublisherInterfaceT):
)

SOURCE: str = "DEFILLAMA"
headers = {
"Accepts": "application/json",
}
api_key: str

headers: dict

publisher: str

def __init__(self, assets: List[PragmaAsset], publisher):
def __init__(self, assets: List[PragmaAsset], publisher, api_key=None):
self.assets = assets
self.publisher = publisher
self.headers = {"Accepts": "application/json"}
if api_key:
self.headers["X-Api-Key"] = api_key

async def _fetch_pair(
self, asset: PragmaSpotAsset, session: ClientSession
Expand Down

0 comments on commit 35ebdec

Please sign in to comment.