Metadata-Version: 2.1
Name: twitch.py
Version: 3.2.10
Summary: Real-time Twitch Event Handling and Helix API Integration in Python
Author-email: Snifo <Snifo@mail.com>
License: MIT
Project-URL: Homepage, https://github.com/mrsnifo/twitch.py
Project-URL: Documentation, https://twitchpy.readthedocs.io/latest/
Project-URL: Issue tracker, https://github.com/mrsnifo/twitch.py/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.8.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp <4,>=3.7.4

# twitch.py

[![PyPI - Version](https://img.shields.io/pypi/v/twitch.py?color=%23673AB7)](https://pypi.org/project/twitch.py)
[![Python Versions](https://img.shields.io/pypi/pyversions/twitch.py?color=%23673AB7)](https://pypi.org/project/twitch.py)

A Python wrapper for Twitch It handles real-time events via WebSocket EventSub and integrates with the Helix API,
all designed for easy asynchronous use.

## Installation

To install **twitch.py**, use the appropriate command for your operating system:

For Windows:

```bash
py -3 -m pip install --upgrade twitch.py
```

For macOS/Linux:

```bash
python3 -m pip install --upgrade twitch.py
```

## Quick Start

Here’s a simple example to get you started with twitch.py:

```python
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:

```python
from twitch import Client
from twitch.types import eventsub
from twitch.ext.oauth import DeviceAuthFlow, Scopes

client = Client(client_id='YOUR_CLIENT_ID')

DeviceAuthFlow(
    client=client,
    scopes=[Scopes.CHANNEL_READ_SUBSCRIPTIONS]
)

@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.event
async def on_subscribe(data: eventsub.channels.SubscribeEvent):
    await client.channel.chat.send_message(f'{data["user_name"]} just Subscribed!')

client.run()
```

## Documentation and Support

For more detailed instructions,
visit the [twitch.py Documentation](https://twitchpy.readthedocs.io/latest/).

Need help or want to join the community? Join the [Discord server](https://discord.gg/UFTkgnse7d).
