Skip to content

Commit b2fefef

Browse files
Fixed story_id issue, close #77
I think this works...
1 parent 614ceea commit b2fefef

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/alerts/api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ async def api_genes(ids: str):
1616
async with session.get(
1717
"https://api.axie.technology/getgenes/" + ids + "/all"
1818
) as r:
19-
return await r.json()
20-
19+
response = await r.json()
20+
if 'message' in response.keys():
21+
raise Exception('Stupid Genes API')
22+
else:
23+
return response
24+
2125

2226
@retry(stop=stop_after_attempt(12), wait=wait_fixed(5))
2327
async def api_new_listings():

src/alerts/genes.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,13 @@ async def get_genes(axie_df, r1, r2, get_auction_info=False):
3636
genes = pd.DataFrame(response)
3737

3838
# Remove ids of axies that are currently in the API as eggs
39-
try:
40-
genes = genes.loc[
41-
~genes.story_id.isin(genes[genes.stage == 1]["story_id"].tolist())
42-
]
43-
44-
# Remove nan ids
45-
genes = genes[genes["story_id"].notna()]
46-
47-
except Exception as e:
48-
print(e)
49-
print("Error with story_id!!!")
50-
with pd.option_context("display.max_rows", None, "display.max_columns", None):
51-
print(axie_df)
39+
genes = genes.loc[
40+
~genes.story_id.isin(genes[genes.stage == 1]["story_id"].tolist())
41+
]
5242

43+
# Remove nan ids
44+
genes = genes[genes["story_id"].notna()]
45+
5346
# Add columns for parts
5447
for part in ["eyes", "ears", "mouth", "horn", "back", "tail"]:
5548
try:

0 commit comments

Comments
 (0)