cookie-api


Namecookie-api JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryAn API wrapper for the Cookie API
upload_time2024-10-27 14:42:14
maintainerNone
docs_urlNone
authortibue99, tobfd
requires_python>=3.9
licenseMIT
keywords discord bot cookie api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/b5/d0/a1f6eda2b9544da5178a5335b9c866f11e7c979d5f92e354a5ee51ac7f49/cookie_api-0.2.1.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.1",
    "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": "3e35d5b1b06cce774b9ba0238dd9957820cc96e7f1090252bd28a4ecb05dd2e2",
                "md5": "c58f64addf372283ab49415231ea6abd",
                "sha256": "6ec45b5a47afb2bacc67312152d01fa75afa883e077c8fc102c56e2bd76ac206"
            },
            "downloads": -1,
            "filename": "cookie_api-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c58f64addf372283ab49415231ea6abd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5902,
            "upload_time": "2024-10-27T14:42:13",
            "upload_time_iso_8601": "2024-10-27T14:42:13.284899Z",
            "url": "https://files.pythonhosted.org/packages/3e/35/d5b1b06cce774b9ba0238dd9957820cc96e7f1090252bd28a4ecb05dd2e2/cookie_api-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b5d0a1f6eda2b9544da5178a5335b9c866f11e7c979d5f92e354a5ee51ac7f49",
                "md5": "3f2d0c777d52629d5184d30852ae7db2",
                "sha256": "7d879a5dd7628acf2d625b6994ec4d451bb6061624bf9315dad5a80c5ad3e4de"
            },
            "downloads": -1,
            "filename": "cookie_api-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3f2d0c777d52629d5184d30852ae7db2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5513,
            "upload_time": "2024-10-27T14:42:14",
            "upload_time_iso_8601": "2024-10-27T14:42:14.756531Z",
            "url": "https://files.pythonhosted.org/packages/b5/d0/a1f6eda2b9544da5178a5335b9c866f11e7c979d5f92e354a5ee51ac7f49/cookie_api-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-27 14:42:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tibue99",
    "github_project": "cookie-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "cookie-api"
}
        
Elapsed time: 0.50432s