melvio / hopla

A Python CLI for habitica.com
Apache License 2.0
17 stars 7 forks source link

Support graceful degradation for new pets and new potions hopla-feed-all #262

Closed melvio closed 2 months ago

melvio commented 3 months ago

Problem: Every new pet and potion added by habitica causes hopla to fail. In particular the hopla feed-all subcommand. (e.g. issue https://github.com/melvio/hopla/issues/234) proposed solution: Update code such that hopla still feeds all not-yet supported pets and potions until the pets/potions are added later.

See: issue #236 for same ticket for hatch-all

melvio commented 2 months ago

Currently failing on 'Raccoon':

[DEBUG][kickstart.py|2024-09-23T14:06:07] start application with arguments: ['/home/m/.local/bin/hopla', 'feed-all']
[DEBUG][feed_all.py|2024-09-23T14:06:07] hopla feed-all no_interactive=False
[DEBUG][connectionpool.py|2024-09-23T14:06:07] Starting new HTTPS connection (1): habitica.com:443
[DEBUG][connectionpool.py|2024-09-23T14:06:08] https://habitica.com:443 "GET /api/v3/user HTTP/1.1" 200 None
Traceback (most recent call last):
  File "/home/m/.local/bin/hopla", line 8, in <module>
    sys.exit(setup_hopla_application())
  File "/home/m/.local/lib/python3.8/site-packages/hopla/__init__.py", line 29, in setup_hopla_application
    kickstart_hopla()
  File "/home/m/.local/lib/python3.8/site-packages/hopla/kickstart.py", line 160, in kickstart_hopla
    hopla()
  File "/home/m/.local/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/m/.local/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/m/.local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/m/.local/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/m/.local/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/m/.local/lib/python3.8/site-packages/hopla/cli/feed_all.py", line 98, in feed_all
    plan: FeedPlan = __get_feed_plan_or_exit()
  File "/home/m/.local/lib/python3.8/site-packages/hopla/cli/feed_all.py", line 27, in __get_feed_plan_or_exit
    zoo: Zoo = ZooBuilder(user).build()
  File "/home/m/.local/lib/python3.8/site-packages/hopla/hoplalib/zoo/zoomodels.py", line 81, in build
    pet = Pet(pet_name, feed_status=FeedStatus(feed_status))
  File "/home/m/.local/lib/python3.8/site-packages/hopla/hoplalib/zoo/petmodels.py", line 40, in __init__
    raise InvalidPet(f"{pet_name=} is not recognized by hopla.\n"
hopla.hoplalib.zoo.petmodels.InvalidPet: pet_name='Raccoon-Base' is not recognized by hopla.
Potential causes: 
* did you spell it correctly?
* Is your pet relatively new? If so, please raise
 an issue at https://github.com/melvio/hopla/issues/new