Real-time Twitch Event Handling and Helix API Integration in Python
Project description
Twitchify
Twitchify simplifies Twitch integration by combining WebSocket EventSub, Helix API, and IRC Chat for real-time event notifications and comprehensive Twitch functionality.
Features
- Real-time Event Notifications: Stay up-to-date with Twitch events through WebSocket EventSub, ensuring your application responds instantly.
- Helix API Support: Access the full power of the Twitch Helix API with a single user access token.
- Bot Support: Easily listen to channel messages.
- Type Hinting: Twitchify includes built-in support for type hinting, promoting code clarity and maintainability.
Why Choose Twitchify?
Twitchify puts the user first, making it ideal for personal use and hassle-free Twitch event setup. Unlike other libraries that require multiple tokens, Twitchify simplifies the process with just one user access token. Developers can create Twitch applications effortlessly, thanks to Twitchify's seamless integration of WebSocket EventSub and Helix API. Real-time event notifications and built-in authentication make handling Twitch events a breeze.
Installation
You can install Twitchify using pip:
# Windows
py -3 -m pip install -U twitchify
# Linux/macOS
python3 -m pip install -U twitchify
Quick Example
from twitch import Client, Follow
client = Client(client_id="YOUR_CLIENT_ID")
@client.event
async def on_ready():
"""
This called when the Twitch client is ready to receive events.
"""
print("Ready as %s" % client.user.display_name)
@client.event
async def on_follow(user: Follow):
"""
This called when a user follows the channel.
"""
print("%s just followed you!" % user.display_name)
# Run the client with your user access token.
client.run(access_token="YOUR_ACCESS_TOKEN")
With built-in Authentication
from twitch import Client, Follow
client = Client(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
@client.event
async def on_ready():
"""
This called when the Twitch client is ready to receive events.
"""
print("Ready as %s" % client.user.display_name)
@client.event
async def on_follow(user: Follow):
"""
This called when a user follows the channel.
"""
print("%s just followed you!" % user.display_name)
@client.event
async def on_auth(access_token: str, refresh_token: str):
"""
This called when the client is successfully authenticated.
"""
# Store those for future use.
print('Received access token:', access_token)
print('Received refresh token:', refresh_token)
# Generate the authorization URL for the Twitch client.
# The user should visit the provided URL to authorize the app.
client.run(scopes=['moderator:read:followers'])
Please refer to the Documentation fore more details.
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-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 976556531dd7df41c86fbd727c5107dd812eea85ef009145f207e65747c55a90 |
|
MD5 | 73f876427ada0a83683db70040478eab |
|
BLAKE2b-256 | 7a933b09f4200ab959f5e3b3b342c6c5e9526ead6c3d373c718b703a953f06fd |