FerranMarin/axie-scholar-utilities

[BUG] Breaking bugs when morphing axies

FerranMarin opened this issue · 1 comments

Describe the bug
Breaking bugs when morphing axies.

To Reproduce
Simply run the tool to morph axies.

Expected behavior
Report the error, but continue execution

Screenshots
Traceback captures:

2021-10-23 03:20:01,198 - INFO: I shall morph all axies I can!
2021-10-23 03:20:06,110 - INFO: Axie 3470879 is already an adult!
Traceback (most recent call last):
  File "axie_scholar_cli.py", line 333, in <module>
    run_cli()
  File "axie_scholar_cli.py", line 281, in run_cli
    axies_to_morph = Axies(acc).find_axies_to_morph()
  File "/opt/app/axie/axies.py", line 36, in find_axies_to_morph
    morph_date, body_shape = self.get_morph_date_and_body(axie)
  File "/opt/app/axie/axies.py", line 57, in get_morph_date_and_body
    body_shape = response.json()["data"]["axie"]["bodyShape"]
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/json/init.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


  File "axie_scholar_cli.py", line 333, in <module>
    run_cli()
  File "axie_scholar_cli.py", line 281, in run_cli
    axies_to_morph = Axies(acc).find_axies_to_morph()
  File "/opt/app/axie/axies.py", line 36, in find_axies_to_morph
    morph_date, body_shape = self.get_morph_date_and_body(axie)
  File "/opt/app/axie/axies.py", line 57, in get_morph_date_and_body
    body_shape = response.json()["data"]["axie"]["bodyShape"]
KeyError: 'data'

  File "axie_scholar_cli.py", line 333, in <module>
    run_cli()
  File "axie_scholar_cli.py", line 281, in run_cli
    axies_to_morph = Axies(acc).find_axies_to_morph()
  File "/opt/app/axie/axies.py", line 36, in find_axies_to_morph
    morph_date, body_shape = self.get_morph_date_and_body(axie)
  File "/opt/app/axie/axies.py", line 57, in get_morph_date_and_body
    body_shape = response.json()["data"]["axie"]["bodyShape"]
TypeError: 'NoneType' object is not subscriptable

Fixed in this commit: ef118e9