Skip to content

Commit

Permalink
Fixed story_id issue, close #77
Browse files Browse the repository at this point in the history
I think this works...
  • Loading branch information
StephanAkkerman committed Nov 17, 2021
1 parent 614ceea commit b2fefef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src/alerts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
19 changes: 6 additions & 13 deletions src/alerts/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b2fefef

Please sign in to comment.