Skip to content

Commit

Permalink
fix: try except
Browse files Browse the repository at this point in the history
  • Loading branch information
dvilelaf committed Nov 30, 2024
1 parent 722151d commit 76b098d
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions packages/dvilela/skills/memeooorr_abci/behaviour_classes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,24 @@ def get_meme_coins_from_subgraph(self) -> Generator[None, None, Optional[List]]:

# Load the response
response_json = json.loads(response.body)
meme_coins = [
{
"token_address": t["id"],
"liquidity": int(t["liquidity"]),
"heart_count": int(t["heartCount"]),
"is_unleashed": t["isUnleashed"],
"timestamp": t["timestamp"],
}
for t in response_json["data"]["memeTokens"]["items"]
if t["chain"] == "base" # TODO: adapt to Celo
]

try:
meme_coins = [
{
"token_address": t["id"],
"liquidity": int(t["liquidity"]),
"heart_count": int(t["heartCount"]),
"is_unleashed": t["isUnleashed"],
"timestamp": t["timestamp"],
}
for t in response_json["data"]["memeTokens"]["items"]
if t["chain"] == "base" # TODO: adapt to Celo
]
except KeyError as e:
self.context.logger.error(
f"Error while pulling the memes from subgraph: {e}"
)
return []

enriched_meme_coins = yield from self.get_extra_meme_info(meme_coins)

Expand Down

0 comments on commit 76b098d

Please sign in to comment.