betterKickAPI


NamebetterKickAPI JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA Python 3.9+ implementation of the Kick API and Webhook. Highly inspired on twitchAPI
upload_time2025-10-23 08:29:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords eventsub api chat event sub kick kick.com kickapi webhook
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Kick API

A full implementation of the Kick API and EventSub in Python 3.9+.

Heavily inspired on [pyTwitchAPI]. My mission is to maintain parity with the [twitchAPI] library for an easier manipulation of both libraries in any project.

> [!NOTE]
> The library was intended to be called `kickAPI` to have parity with [twitchAPI], but the name is already taken. So the library was re-branded to `kick_api`.
>
> Update:\
> PyPI didn't like `kick_api`, a friend of mine recommended me `betterKickAPI`, and I liked it. So, re-branded to `betterKickAPI`.

> [!TIP]
> Also try [kickpython] that includes his own WebSocket implementation!

## Installation

Install using pip:
```
pip install betterKickAPI
```

Install using uv:
```
uv add betterKickAPI
```

<!-- ## Documentation

A full API documentation can be found on readthedocs.org. -->

## Usage

### Basic API calls

Setting up an instance of the Kick API and get your User ID.

```python
from betterKickAPI.kick import Kick
from betterKickAPI.helper import first
import asyncio

async def kick_example():
        # Initialize the kick instance, this will by default also create an app authentication for you
        kick = await Kick('APP_ID', 'APP_SECRET')

        # this returns an async generator that can be used to iterate over all results
        # but we are just interested in the first result
        # using the first helper makes this easy
        user = await first(kick.get_users(slug='your_kick_user'))
        # print the ID of your user
        print(user.broadcaster_user_id)

# run this example
asyncio.run(kick_example())
```

### Authentication

The Kick API knows 2 different authentications. App and User Authentication. Which one you need (or if one at all) depends on what calls you want to use.

###  App Authentication

```python
from betterKickAPI.kick import Kick
kick = await Kick('APP_ID', 'APP_SECRET')
```

### User Authentication

To get a user auth token, the user has to explicitly click "Allow access" on the Kick website. The library includes an Authenticator. Just remember to add `http://localhost:36571` in your redirect URIs in the [dev settings tab](https://kick.com/settings/developer).

```python
from betterKickAPI.kick import Kick
from betterKickAPI.oauth import UserAuthenticator
from betterKickAPI.type import OAuthScope

kick = await Kick('APP_ID', 'APP_SECRET')

target_scope = [OAuthScope.CHANNEL_READ]
auth = UserAuthenticator(kick, target_scope, force_verify=False)
# this will open your default browser and prompt you with the kick auth website
token, refresh_token = await auth.authenticate()

await kick.set_user_authentication(token, target_scope, refresh_token)
```

You can reuse this token and use the refresh_token to renew it:
```python
from betterKickAPI.oauth import refresh_access_token
new_token, new_refresh_token = await refresh_access_token('refresh_token', 'APP_ID', 'APP_SECRET')
```

### AuthToken refresh callback

Optionally you can set a callback for both user access token refresh and app access token refresh.

```python
from betterKickAPI.kick import Kick

async def app_refresh(token: str):
        print(f'my new ap token is:{token}')

async def user_refresh(token: str, refresh_token: str):
        print(f'my new user token is: {token}')

kick = await Kick('APP_ID', 'APP_SECRET')
kick.app_auth_refresh_callback = app_refresh
kick.user_auth_refresh_callback = user_refresh
```

### EventSub

EventSub lets you listen for events that happen on Kick.

The EventSub client runs in its own process, calling the given callback function whenever an event happens.

> [!IMPORTANT]
> At the moment, the Kick API offers Webhook as the only method to use EventSub. But there's already plans on adding WebSockets.

## TODO

- Use aiohttp instead of httpx because of performance (or another better alternative).
- Considering getting rid of socketify because of linux dependencies.
- Add documentation.
- Add EventSub WebSockets when available.

## Acknowledges

- [pyTwitchAPI]: A Python 3.7 compatible implementation of the Twitch API, EventSub and Chat.
- [KickPython]: Kick.com Python Public API Wrapper

[pyTwitchAPI]: https://github.com/Teekeks/pyTwitchAPI
[twitchAPI]: https://pypi.org/project/twitchAPI/
[KickPython]: https://github.com/berkay-digital/kickpython

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "betterKickAPI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "EventSub, api, chat, event sub, kick, kick.com, kickapi, webhook",
    "author": null,
    "author_email": "Benjas333 <seston30@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9f/cc/8035d1ce948da62983d6dbe448df1285166f4aa73b542ecdcd16a5e8198b/betterkickapi-0.3.0.tar.gz",
    "platform": null,
    "description": "# Python Kick API\n\nA full implementation of the Kick API and EventSub in Python 3.9+.\n\nHeavily inspired on [pyTwitchAPI]. My mission is to maintain parity with the [twitchAPI] library for an easier manipulation of both libraries in any project.\n\n> [!NOTE]\n> The library was intended to be called `kickAPI` to have parity with [twitchAPI], but the name is already taken. So the library was re-branded to `kick_api`.\n>\n> Update:\\\n> PyPI didn't like `kick_api`, a friend of mine recommended me `betterKickAPI`, and I liked it. So, re-branded to `betterKickAPI`.\n\n> [!TIP]\n> Also try [kickpython] that includes his own WebSocket implementation!\n\n## Installation\n\nInstall using pip:\n```\npip install betterKickAPI\n```\n\nInstall using uv:\n```\nuv add betterKickAPI\n```\n\n<!-- ## Documentation\n\nA full API documentation can be found on readthedocs.org. -->\n\n## Usage\n\n### Basic API calls\n\nSetting up an instance of the Kick API and get your User ID.\n\n```python\nfrom betterKickAPI.kick import Kick\nfrom betterKickAPI.helper import first\nimport asyncio\n\nasync def kick_example():\n        # Initialize the kick instance, this will by default also create an app authentication for you\n        kick = await Kick('APP_ID', 'APP_SECRET')\n\n        # this returns an async generator that can be used to iterate over all results\n        # but we are just interested in the first result\n        # using the first helper makes this easy\n        user = await first(kick.get_users(slug='your_kick_user'))\n        # print the ID of your user\n        print(user.broadcaster_user_id)\n\n# run this example\nasyncio.run(kick_example())\n```\n\n### Authentication\n\nThe Kick API knows 2 different authentications. App and User Authentication. Which one you need (or if one at all) depends on what calls you want to use.\n\n###  App Authentication\n\n```python\nfrom betterKickAPI.kick import Kick\nkick = await Kick('APP_ID', 'APP_SECRET')\n```\n\n### User Authentication\n\nTo get a user auth token, the user has to explicitly click \"Allow access\" on the Kick website. The library includes an Authenticator. Just remember to add `http://localhost:36571` in your redirect URIs in the [dev settings tab](https://kick.com/settings/developer).\n\n```python\nfrom betterKickAPI.kick import Kick\nfrom betterKickAPI.oauth import UserAuthenticator\nfrom betterKickAPI.type import OAuthScope\n\nkick = await Kick('APP_ID', 'APP_SECRET')\n\ntarget_scope = [OAuthScope.CHANNEL_READ]\nauth = UserAuthenticator(kick, target_scope, force_verify=False)\n# this will open your default browser and prompt you with the kick auth website\ntoken, refresh_token = await auth.authenticate()\n\nawait kick.set_user_authentication(token, target_scope, refresh_token)\n```\n\nYou can reuse this token and use the refresh_token to renew it:\n```python\nfrom betterKickAPI.oauth import refresh_access_token\nnew_token, new_refresh_token = await refresh_access_token('refresh_token', 'APP_ID', 'APP_SECRET')\n```\n\n### AuthToken refresh callback\n\nOptionally you can set a callback for both user access token refresh and app access token refresh.\n\n```python\nfrom betterKickAPI.kick import Kick\n\nasync def app_refresh(token: str):\n        print(f'my new ap token is:{token}')\n\nasync def user_refresh(token: str, refresh_token: str):\n        print(f'my new user token is: {token}')\n\nkick = await Kick('APP_ID', 'APP_SECRET')\nkick.app_auth_refresh_callback = app_refresh\nkick.user_auth_refresh_callback = user_refresh\n```\n\n### EventSub\n\nEventSub lets you listen for events that happen on Kick.\n\nThe EventSub client runs in its own process, calling the given callback function whenever an event happens.\n\n> [!IMPORTANT]\n> At the moment, the Kick API offers Webhook as the only method to use EventSub. But there's already plans on adding WebSockets.\n\n## TODO\n\n- Use aiohttp instead of httpx because of performance (or another better alternative).\n- Considering getting rid of socketify because of linux dependencies.\n- Add documentation.\n- Add EventSub WebSockets when available.\n\n## Acknowledges\n\n- [pyTwitchAPI]: A Python 3.7 compatible implementation of the Twitch API, EventSub and Chat.\n- [KickPython]: Kick.com Python Public API Wrapper\n\n[pyTwitchAPI]: https://github.com/Teekeks/pyTwitchAPI\n[twitchAPI]: https://pypi.org/project/twitchAPI/\n[KickPython]: https://github.com/berkay-digital/kickpython\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python 3.9+ implementation of the Kick API and Webhook. Highly inspired on twitchAPI",
    "version": "0.3.0",
    "project_urls": {
        "Changelog": "https://github.com/Benjas333/pyKickAPI/blob/master/CHANGELOG.md",
        "Issues": "https://github.com/Benjas333/pyKickAPI/issues",
        "Repository": "https://github.com/Benjas333/pyKickAPI"
    },
    "split_keywords": [
        "eventsub",
        " api",
        " chat",
        " event sub",
        " kick",
        " kick.com",
        " kickapi",
        " webhook"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a92a912461f4589f7e960339af7cba4270c45c14aa67d27b8f70f9388c6afded",
                "md5": "573378f119ac3eb26f548d151f8fe7ed",
                "sha256": "1adba984e2ddf33d0412d7c1158fe6818176fe1aba27840cba93a9c001bac2cc"
            },
            "downloads": -1,
            "filename": "betterkickapi-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "573378f119ac3eb26f548d151f8fe7ed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 38118,
            "upload_time": "2025-10-23T08:29:16",
            "upload_time_iso_8601": "2025-10-23T08:29:16.669430Z",
            "url": "https://files.pythonhosted.org/packages/a9/2a/912461f4589f7e960339af7cba4270c45c14aa67d27b8f70f9388c6afded/betterkickapi-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9fcc8035d1ce948da62983d6dbe448df1285166f4aa73b542ecdcd16a5e8198b",
                "md5": "25b7f99e04ff791d1da893424feabc9f",
                "sha256": "bc550ee89af36ce5c388d00157697d0b7b85912ecc1da3d3fef72a001119bf10"
            },
            "downloads": -1,
            "filename": "betterkickapi-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "25b7f99e04ff791d1da893424feabc9f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 32441,
            "upload_time": "2025-10-23T08:29:17",
            "upload_time_iso_8601": "2025-10-23T08:29:17.865103Z",
            "url": "https://files.pythonhosted.org/packages/9f/cc/8035d1ce948da62983d6dbe448df1285166f4aa73b542ecdcd16a5e8198b/betterkickapi-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 08:29:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Benjas333",
    "github_project": "pyKickAPI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "betterkickapi"
}
        
Elapsed time: 1.13639s