Compare commits
3 Commits
93fe1beb2f
...
818affc74b
| Author | SHA1 | Date | |
|---|---|---|---|
| 818affc74b | |||
| 645f7029ad | |||
| 63a874b94c |
@ -37,9 +37,10 @@ import asyncio
|
||||
from oxidetwitch.api import TwitchAPIClient
|
||||
|
||||
async def main():
|
||||
async with TwitchClient(
|
||||
async with TwitchAPIClient(
|
||||
client_id="your_id",
|
||||
client_secret="your_client_secret",
|
||||
redirect_uri="https://example.com",
|
||||
redis_url="redis://localhost:6379",
|
||||
) as twitch:
|
||||
# Get user data (automatically cached if configured)
|
||||
@ -57,11 +58,10 @@ If you are polling 100+ streams, OxideTwitch spaces out the requests using the *
|
||||
|
||||
```python
|
||||
async def poll_streams(channels):
|
||||
async with TwitchClient(...) as twitch:
|
||||
async with TwitchAPIClient(...) as twitch:
|
||||
# These will be executed as fast as the rate limiter allows
|
||||
tasks = [twitch.get_stream(user_login=name) for name in channels]
|
||||
tasks = [twitch.get_streams(..., user_login=name) for name in channels]
|
||||
streams = await asyncio.gather(*tasks)
|
||||
return [s for s in streams if s.is_live]
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "oxidetwitch"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
description = "Client for Twitch API"
|
||||
readme = "README.md"
|
||||
authors = [{ name = "Miwory", email = "miwory.uwu@gmail.com" }]
|
||||
|
||||
@ -23,7 +23,7 @@ class TwitchAPIClient(OxideHTTP):
|
||||
redis_url: str | None = None,
|
||||
proxy_url: str | None = None,
|
||||
) -> None:
|
||||
self.base_uri = 'https://api.twitch.tv/helix'
|
||||
self.base_uri = 'https://api.twitch.tv/helix/'
|
||||
self.client_id = client_id
|
||||
self.client_secret = client_secret
|
||||
self.redirect_uri = redirect_uri
|
||||
|
||||
@ -16,7 +16,7 @@ class TwitchAuthClient(OxideHTTP):
|
||||
redis_url: str | None = None,
|
||||
proxy_url: str | None = None,
|
||||
) -> None:
|
||||
self.base_uri = 'https://id.twitch.tv/oauth2'
|
||||
self.base_uri = 'https://id.twitch.tv/oauth2/'
|
||||
self.client_id = client_id
|
||||
self.client_secret = client_secret
|
||||
self.redirect_uri = redirect_uri
|
||||
|
||||
Reference in New Issue
Block a user