How can I fetch cats from cataas.com API in python?
Emily Wong
I want to fetch a list cats based on a search input entered, I am not sure of the end point to use . I want something like this here
I have tried to make a request to the API using requests API but I am not getting the desired results. Here is the code below
import requests
def get_cats(): response = requests.get(') print(response.json())
get_cats()I am not getting any json format of cats but just an error:
"C:\Users\Developer\Anaconda3\lib\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). 1 Answer
OK so after a real struggle I found a good endpoint that returns json and I got the code working. You can actually check it on my repo django cataas app
The endpoint is
A little documentation is as follows:
/api/cats => get all cats
/api/cats?tags=cute => get all cats with cute tag
/api/cats?tags=cute,gif => get all cats with cute tag OR gif tag
/api/cats?limit=10 => get last 10 cats
/api/cats?limit=10&skip=10 => get last 10 cats after skip 10 of them
/api/cats?limit=6&tags=cute => get last 6 cats with cute tag`