Skip to main content

7TV EventAPI Wrapper

Discord Server Python Version PyPI Version PyPI Downloads

This is a Python wrapper for the 7TV EventAPI, which provides async access to the websocket events on their Emote Platform.

Requirements

  • Python 3.8 or higher

Installation

You can install the 7TV EventAPI Wrapper using pip. Open your terminal and run the following command:

pip install eventapi

Usage

Here's an simple example of how to use wrapper:

import asyncio

from eventapi.EventApi import EventApi
from eventapi.WebSocket import (
    Dispatch,
    EventType,
    ResponseTypes,
    SubscriptionCondition,
    SubscriptionData,
)


async def callback(data: ResponseTypes):
    if isinstance(data, Dispatch):
        print(f"Event data type: {data.type}")
        print(f"Event data body: {data.body}")
    else:
        print(f"Raw event data: {data.raw_data}")


async def main():
    # create instance of EventApi with message callback
    app = EventApi(callback=callback)

    # connect to websocket
    await app.connect()

    # create subscription with specified condition
    condition = SubscriptionCondition(object_id="6433b7cec07d26f890dd2d01")
    subscription = SubscriptionData(
        subscription_type=EventType.EMOTE_SET_ALL, condition=condition
    )
    await app.subscribe(subscription_data=subscription)

    # run forever
    await asyncio.Future()


asyncio.run(main())

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.

Download files

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

Source Distribution

eventapi-1.0.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

eventapi-1.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file eventapi-1.0.2.tar.gz.

File metadata

  • Download URL: eventapi-1.0.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for eventapi-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2d5acbef70bba54f29e7e5bcfb7cecc0fdcce14290fe7fac4c98313eb7c3aed4
MD5 c51148a06d68c313fea0110eb9c6aff1
BLAKE2b-256 cbfb01bcfa4156669aa35aad153ff04f8fd13388bc39a04908de9f7b9258e2fc

See more details on using hashes here.

File details

Details for the file eventapi-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: eventapi-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for eventapi-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b250ec10c16560eb594832667dc336fa2d5a5c77edf32e56a47131bb47b3fd7c
MD5 f884aaabc114bff7ba37e82f240f4e8c
BLAKE2b-256 cad1bee84caafe3658c70567062fb767cea2330d981920b12aba237a7686b699

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page