Real-time Twitch Event Handling and Helix API Integration in Python
Project description
Twitchify
Twitchify is a Python library designed for seamless Twitch event handling via WebSocket EventSub and API integration through the Helix API. It simplifies building Twitch apps by combining both real-time event notifications and API functionality into a single, user-friendly package.
Installation
Install Twitchify using pip:
# On Windows
py -3 -m pip install -U twitchify
# On Linux/macOS
python3 -m pip install -U twitchify
Quick Start
Here’s a simple example to get you started with Twitchify:
from twitch import Client
from twitch.types import eventsub
client = Client(client_id='YOUR_CLIENT_ID')
@client.event
async def on_ready():
print('Client is ready!')
@client.event
async def on_follow(data: eventsub.channels.FollowEvent):
await client.channel.chat.send_message(f'{data["user_name"]} just followed the channel!')
client.run('YOUR_USER_ACCESS_TOKEN')
OAuth Authentication
Authenticate easily with Twitch using the Device Flow authentication method:
from twitch import Client
from twitch.ext.oauth import DeviceAuthFlow, Scopes
client = Client(client_id='YOUR_CLIENT_ID')
DeviceAuthFlow(
client=client,
scopes=[Scopes.USER_READ_FOLLOWS]
)
@client.event
async def on_code(code: str):
print(f'Go to https://www.twitch.tv/activate and enter this code: {code}')
@client.event
async def on_auth(access_token: str, refresh_token: str):
print(f'Access Token: {access_token}')
client.run()
Documentation and Support
For more detailed instructions, visit the Twitchify Documentation.
Need help or want to join the community? Join the Discord server.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for twitchify-3.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6186f36022c86a456a89a106893a885a63addaafdc3af60cc508302ad753ce2 |
|
MD5 | 408ba5425dcb10fccd2841bcdd47e4f2 |
|
BLAKE2b-256 | f801a125aab97dddf15f34d1acfd73720235177d6966657dc00c24dbb8b17bed |