A simple Flask API that serves random cat pictures. Made by Ethan!
- Random cat image endpoint
- Landing page with usage instructions
- Simple to deploy and use
- Fork this repl
- Click the Run button
- Your API will be available at your repl's URL
The API will be accessible at:
- Landing page:
https://your-repl-url/
- Random cat endpoint:
https://your-repl-url/api/cat
- GET
/api/cat
- Get a random cat image - GET
/api/cats/count
- Get total number of cats - GET
/api/cats/list
- Get list of all cat filenames - GET
/api/cats/random/{count}
- Get multiple random cats (1-5) - POST
/api/cats/vote
- Vote for a cat (requires JSON body with cat_id)
Get a random cat:
import requests
response = requests.get('https://your-repl-url/api/cat')
with open('cat.jpg', 'wb') as f:
f.write(response.content)
Vote for a cat:
import requests
response = requests.post('https://your-repl-url/api/cats/vote',
json={'cat_id': 'cat1.jpg'})
print(response.json())
Python example:
import requests
response = requests.get('https://your-repl-url/api/cat')
with open('cat.jpg', 'wb') as f:
f.write(response.content)