{"id":46691,"library":"twitchapi","title":"pyTwitchAPI","description":"A Python 3.7+ implementation of the Twitch Helix API, EventSub and Chat. This library provides async and sync interfaces for Twitch API endpoints, including authentication, events, and chat bots. Current version 4.5.0 is stable but has significant breaking changes from v3. The project is actively maintained with regular releases.","status":"active","version":"4.5.0","language":"python","source_language":"en","source_url":"https://github.com/Teekeks/pyTwitchAPI","tags":["twitch","api","helix","eventsub","chat","oauth"],"install":[{"cmd":"pip install twitchapi","lang":"bash","label":"Install the library"},{"cmd":"pip install twitchapi[aiohttp]","lang":"bash","label":"Install with async HTTP support (recommended)"}],"dependencies":[{"reason":"Required for async HTTP requests (optional but recommended)","package":"aiohttp","optional":true},{"reason":"Used for sync HTTP calls (fallback if aiohttp not installed)","package":"requests","optional":true}],"imports":[{"note":"Direct import from twitchapi is deprecated; use submodule twitchAPI.twitch","wrong":"from twitchapi import Twitch","symbol":"Twitch","correct":"from twitchAPI.twitch import Twitch"},{"note":"OAuth classes moved to twitchAPI.oauth","wrong":"from twitchAPI.auth import TwitchClientCredentials","symbol":"TwitchClientCredentials","correct":"from twitchAPI.oauth import TwitchClientCredentials"}],"quickstart":{"code":"import asyncio\nfrom twitchAPI.twitch import Twitch\nfrom twitchAPI.oauth import TwitchClientCredentials\nimport os\n\nasync def main():\n    app_id = os.environ.get('TWITCH_APP_ID', '')\n    app_secret = os.environ.get('TWITCH_APP_SECRET', '')\n    if not app_id or not app_secret:\n        print('Set TWITCH_APP_ID and TWITCH_APP_SECRET environment variables')\n        return\n    creds = TwitchClientCredentials(app_id, app_secret)\n    twitch = Twitch(creds)\n    user = await twitch.get_users(logins=['twitch'])\n    print(user)\n\nif __name__ == '__main__':\n    asyncio.run(main())","lang":"python","description":"Initialize Twitch client with app credentials and fetch a user"},"warnings":[{"fix":"Migrate to new class hierarchy: use Twitch from twitchAPI.twitch, TwitchClientCredentials from twitchAPI.oauth, etc.","message":"v4.0+ completely rewrote the API: classes and methods changed. Old v3 code will not work.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use Twitch and EventSub classes instead. For PubSub, use twitchAPI.pubsub.TwitchPubSub (still available but deprecated).","message":"Sync TwitchClient and TwitchPubSub are deprecated in v4. Use async equivalents.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Store TwitchClientCredentials and Twitch instance as singletons.","message":"Authentication objects (TwitchClientCredentials, UserAuthenticator) must be reused; creating new ones every request will hit rate limits.","severity":"gotcha","affected_versions":"all"},{"fix":"Use TwitchClientCredentials which handles token refresh automatically via the Twitch instance.","message":"App access tokens expire after 60 days; you must refresh or re-authenticate.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.7':4 '4.5.0':33 'activ':46 'api':10,23,52 'async':17 'authent':26 'bot':30 'break':39 'chang':40 'chat':13,29,55 'current':31 'endpoint':24 'event':27 'eventsub':11,54 'helix':9,53 'implement':5 'includ':25 'interfac':20 'librari':15 'maintain':47 'oauth':56 'project':44 'provid':16 'python':3 'pytwitchapi':1 'regular':49 'releas':50 'signific':38 'stabl':35 'sync':19 'twitch':8,22,51 'v3':42 'version':32","created_at":"2026-06-07T13:01:09.005274+00:00","updated_at":"2026-06-07T13:01:09.005274+00:00","problems":[{"fix":"Upgrade to v4: pip install --upgrade twitchapi. Then import from twitchAPI.twitch import Twitch","cause":"Installed twitchapi (v3) but trying to import from twitchAPI (v4). v3 had module name 'twitchapi', v4 uses 'twitchAPI'.","error":"ModuleNotFoundError: No module named 'twitchAPI'"},{"fix":"Use: from twitchAPI.twitch import Twitch","cause":"Wrong import path: trying to import Twitch directly from twitchAPI instead of twitchAPI.twitch.","error":"AttributeError: module 'twitchAPI' has no attribute 'Twitch'"},{"fix":"Use async Twitch class: from twitchAPI.twitch import Twitch. Replace TwitchClient with Twitch.","cause":"Using sync class TwitchClient (deprecated) in an async context.","error":"TypeError: object can't be used in 'await' expression"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Teekeks/pyTwitchAPI","github":"https://github.com/Teekeks/pyTwitchAPI","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","analytics"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}