Skip to main content

Twitch API Python client

Project description

py-twitch

python

py-twitch is Twitch Helix REST API client library.

This library supports typing using dataclass, so you can use IDE's auto complete.

Note

Api with OAuth is not implemented. It will be implemented in the future.

Installation

pip install py-twitch

Requirements

  • python ( > 3.7 )
  • requests
  • dacite

Usage

every client method named method_url.

For example, GET https://api.twitch.tv/helix/users is defined as get_users

Example

Single Parameter Example

from twitch.client import TwitchAPIClient
client_id = "YOUR CLIENT ID"
client_secret = "YOUR CLIENT SECRET"

client = TwitchAPIClient(client_id, client_secret)

# Default Example
pagination = None
while True:

	data = client.get_users_follows(from_id="171003792", after=pagination)
	pagination = data.pagination.cursor

	for user in data.data:
		print(f"{171003792} following {user.to_name}")

	if not pagination:
		break

Multiple Parameter Example

from twitch.client import TwitchAPIClient
client_id = "YOUR CLIENT ID"
client_secret = "YOUR CLIENT SECRET"

client = TwitchAPIClient(client_id, client_secret)

# Multi Query Parameters Example
data = client.get_users(id=["141981764", "171003792"])
for user in data.data:
	print(f"display_name is {user.display_name}")

print(data)

TODO

  • Implements OAuth Methods

  • Change fields(such as started_at) type to DateTimeField

  • Check Optional fields and List fields

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_twitch-0.1.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file py_twitch-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: py_twitch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for py_twitch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6add428432d366f4ef7ad616e637535cbd87777e61960aaa835ed4ecfc44a510
MD5 4445f6fe68e72500a9af1bfb791f74d6
BLAKE2b-256 379b1904cc6637d778d6b5f8f14a85ffbb2f4c7771f2818fd9c5b06f1dff588d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page