# 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 CookieAPI
api = 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 AsyncCookieAPI
api = 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).
Raw data
{
"_id": null,
"home_page": null,
"name": "cookie-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "discord, bot, cookie, api",
"author": "tibue99, tobfd",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/73/ce/42178795b2b588a4d406404d03f1e3958648d1e8a37e8f986fef673b3c0e/cookie_api-0.2.2.tar.gz",
"platform": null,
"description": "# Cookie API\n[![](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/)\n[![](https://img.shields.io/pypi/l/cookie-api?style=for-the-badge&color=5865F2)](https://github.com/tibue99/cookie-api/blob/main/LICENSE)\n[![](https://img.shields.io/readthedocs/cookie-api?style=for-the-badge)](https://cookie-api.readthedocs.io/)\n[![](https://img.shields.io/badge/Cookie-Website-orange?style=for-the-badge)](https://cookieapp.me/)\n\nOfficial wrapper for the [Cookie](https://cookieapp.me) API.\n\n## \u2699\ufe0f Installation\nPython 3.9 or higher is required\n```\npip install cookie-api\n```\n\n## \ud83d\udd11 How to get an API key?\n1. Invite [Cookie](https://cookieapp.me) to your Discord server or to your Discord account\n2. Run `/premium api`\n\n## \ud83d\ude80 Example Usage\nThe API key can be passed as a parameter or set as the environment variable `COOKIE_KEY`.\nFor more information, see to our [documentation](https://cookie-api.readthedocs.io/).\n\n### Sync Example\n```python\nfrom cookie import CookieAPI\n\napi = CookieAPI(api_key=\"[YOUR_API_KEY]\")\n\nuser_stats = api.get_user_stats(123456789) # Replace with user ID\n```\n### Async Example\n```python\nimport asyncio\nfrom cookie import AsyncCookieAPI\n\napi = AsyncCookieAPI(api_key=\"[YOUR_API_KEY]\")\n\nasync def main():\n user_stats = await api.get_user_stats(123456789) # Replace with user ID\n await api.close()\n\nasyncio.run(main())\n```\nYou can also use an asynchronous context manager (recommended)\n```python\nasync def main():\n async with api as con:\n user_stats = await con.get_user_stats(123456789) # Replace with user ID\n```\n\n## \u26a1 FastAPI Docs\nIf you want to use the API without this wrapper, you can find the FastAPI docs [here](https://api.cookie-bot.xyz/docs).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An API wrapper for the Cookie API",
"version": "0.2.2",
"project_urls": {
"Cookie": "https://cookieapp.me",
"Documentation": "https://cookie-api.readthedocs.io",
"GitHub": "https://github.com/tibue99/cookie-api"
},
"split_keywords": [
"discord",
" bot",
" cookie",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8b5de72beff08fdbbae3d0bbe4c6d96feb61bebf837597d5d011d34d7094c35e",
"md5": "b617a0f9305b61594d2ab96924f2cfb0",
"sha256": "0c90eca3ed15b7b116fa3a76f49eb54df628b7e9f544287d7d455e40b462f2e0"
},
"downloads": -1,
"filename": "cookie_api-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b617a0f9305b61594d2ab96924f2cfb0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6171,
"upload_time": "2024-12-14T16:51:13",
"upload_time_iso_8601": "2024-12-14T16:51:13.204941Z",
"url": "https://files.pythonhosted.org/packages/8b/5d/e72beff08fdbbae3d0bbe4c6d96feb61bebf837597d5d011d34d7094c35e/cookie_api-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "73ce42178795b2b588a4d406404d03f1e3958648d1e8a37e8f986fef673b3c0e",
"md5": "6cee099329e17ef35f1ba9e78fc3ddb7",
"sha256": "4df0a17239d597d24c174aa7a0a5d99f513d5b61eef0c23cebf7c99f8393a597"
},
"downloads": -1,
"filename": "cookie_api-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "6cee099329e17ef35f1ba9e78fc3ddb7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6379,
"upload_time": "2024-12-14T16:51:15",
"upload_time_iso_8601": "2024-12-14T16:51:15.510480Z",
"url": "https://files.pythonhosted.org/packages/73/ce/42178795b2b588a4d406404d03f1e3958648d1e8a37e8f986fef673b3c0e/cookie_api-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-14 16:51:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tibue99",
"github_project": "cookie-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "httpx",
"specs": []
},
{
"name": "python-dotenv",
"specs": []
}
],
"lcname": "cookie-api"
}