diff --git a/src/alerts/api.py b/src/alerts/api.py index 295cf1c..5968207 100644 --- a/src/alerts/api.py +++ b/src/alerts/api.py @@ -16,8 +16,12 @@ async def api_genes(ids: str): async with session.get( "https://api.axie.technology/getgenes/" + ids + "/all" ) as r: - return await r.json() - + response = await r.json() + if 'message' in response.keys(): + raise Exception('Stupid Genes API') + else: + return response + @retry(stop=stop_after_attempt(12), wait=wait_fixed(5)) async def api_new_listings(): diff --git a/src/alerts/genes.py b/src/alerts/genes.py index a4251cc..71ee5f7 100644 --- a/src/alerts/genes.py +++ b/src/alerts/genes.py @@ -36,20 +36,13 @@ async def get_genes(axie_df, r1, r2, get_auction_info=False): genes = pd.DataFrame(response) # Remove ids of axies that are currently in the API as eggs - try: - genes = genes.loc[ - ~genes.story_id.isin(genes[genes.stage == 1]["story_id"].tolist()) - ] - - # Remove nan ids - genes = genes[genes["story_id"].notna()] - - except Exception as e: - print(e) - print("Error with story_id!!!") - with pd.option_context("display.max_rows", None, "display.max_columns", None): - print(axie_df) + genes = genes.loc[ + ~genes.story_id.isin(genes[genes.stage == 1]["story_id"].tolist()) + ] + # Remove nan ids + genes = genes[genes["story_id"].notna()] + # Add columns for parts for part in ["eyes", "ears", "mouth", "horn", "back", "tail"]: try: