Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tibue99/cookie-api
Official wrapper for the Cookie API
https://github.com/tibue99/cookie-api
api bot cookie discord
Last synced: about 1 month ago
JSON representation
Official wrapper for the Cookie API
- Host: GitHub
- URL: https://github.com/tibue99/cookie-api
- Owner: tibue99
- License: mit
- Created: 2024-05-13T17:17:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-27T14:41:24.000Z (2 months ago)
- Last Synced: 2024-10-27T15:09:21.239Z (2 months ago)
- Topics: api, bot, cookie, discord
- Language: Python
- Homepage: https://cookie-api.readthedocs.io/
- Size: 51.8 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cookie API
[![](https://img.shields.io/pypi/v/cookie-api.svg?style=for-the-badge&logo=pypi&color=yellow&logoColor=white)](https://pypi.org/project/cookie-api/)
[![](https://img.shields.io/pypi/l/cookie-api?style=for-the-badge&color=5865F2)](https://github.com/tibue99/cookie-api/blob/main/LICENSE)
[![](https://img.shields.io/readthedocs/cookie-api?style=for-the-badge)](https://cookie-api.readthedocs.io/)
[![](https://img.shields.io/badge/Cookie-Website-orange?style=for-the-badge)](https://cookieapp.me/)Official wrapper for the [Cookie](https://cookieapp.me) API.
## ⚙️ Installation
Python 3.9 or higher is required
```
pip install cookie-api
```## 🔑 How to get an API key?
1. Invite [Cookie](https://cookieapp.me) to your Discord server or to your Discord account
2. Run `/premium api`## 🚀 Example Usage
The API key can be passed as a parameter or set as the environment variable `COOKIE_KEY`.
For more information, see to our [documentation](https://cookie-api.readthedocs.io/).### Sync Example
```python
from cookie import CookieAPIapi = CookieAPI(api_key="[YOUR_API_KEY]")
user_stats = api.get_user_stats(123456789) # Replace with user ID
```
### Async Example
```python
import asyncio
from cookie import AsyncCookieAPIapi = AsyncCookieAPI(api_key="[YOUR_API_KEY]")
async def main():
user_stats = await api.get_user_stats(123456789) # Replace with user ID
await api.close()asyncio.run(main())
```
You can also use an asynchronous context manager (recommended)
```python
async def main():
async with api as con:
user_stats = await con.get_user_stats(123456789) # Replace with user ID
```## ⚡ FastAPI Docs
If you want to use the API without this wrapper, you can find the FastAPI docs [here](https://api.cookie-bot.xyz/docs).