Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Errors in cat-facts python code #12

Open
jose-nuno-sousa-alb opened this issue Dec 16, 2020 · 1 comment
Open

Errors in cat-facts python code #12

jose-nuno-sousa-alb opened this issue Dec 16, 2020 · 1 comment

Comments

@jose-nuno-sousa-alb
Copy link

Description
The provided code in the template will throw an error when running the actions as the schema of the message delivered by the API (https://cat-fact.herokuapp.com/facts) seems to have changed.

This might be related with #9 however the API is currently responding (maybe the service changed?).

There are other errors in the same code, the method that picks a random fact might throw an index out of bounds error and it is fetching the length of the facts list from the parent execution context.

To Reproduce
Steps to reproduce the behavior:
Run the python code provided in the template in a suitable env (with requests module installed)

Expected behavior
The output should be 2 lines with a random cat fact and the set-output with it, for example:

The technical term for a cat’s hairball is a bezoar.
::set-output name=fact::The technical term for a cat’s hairball is a bezoar.

Screenshots
Screenshot from 2020-12-16 13-53-11
Screenshot from 2020-12-16 14-03-32

Additional context
I've finished the course without this problem by fixing the python code:
Screenshot from 2020-12-16 14-00-33

@jose-nuno-sousa-alb
Copy link
Author

This issue correction overlaps with the pull request #10 where changes were made to the API used.

However please note that the the code used to pick a random fact might still throw an error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant