Neko's.API
neko
Here's an example of fetching a neko image with the neko endpoint.
Fetching a neko image
Get a neko image & its details.
GET
https://nekos.pro/api/neko
{
"id": 497,
"url": "https://cdn.nekos.pro/neko/e80d4b93b63c40898bbbdcbefe40d232.jpg"
}
Python example:
import aiohttp
headers = {'Content-type': 'application/json'}
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get('https://nekos.pro/api/neko') as resp:
image = await resp.json()
print(image['url'])
This example assumes you are using asyncio & running a Discord bot, which you should be using instead of requests, which is blocking.
neko
Here's an example of fetching a neko image with the neko endpoint.
Fetching a neko image
Get a neko image & its details.
GET
https://nekos.pro/api/neko
200: OK Response details
429: Too Many Requests Response details
Copy
{
"id": 497,
"url": "https://cdn.nekos.pro/neko/e80d4b93b63c40898bbbdcbefe40d232.jpg"
}
Python example:
Copy
import aiohttp
headers = {'Content-type': 'application/json'}
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get('https://nekos.pro/api/neko') as resp:
image = await resp.json()
print(image['url'])
This example assumes you are using asyncio & running a Discord bot, which you should be using instead of requests, which is blocking.
Comments
Post a Comment