Skip to main content

OpenTriviaDB

An asynchronous wrapper for the Open Trivia DB API.

This is an unofficial wrapper, and is not affiliated with PIXELTAIL GAMES LLC.

Installation

To install the latest stable version of OpenTriviaDB, use the following command:

pip install opentriviadb

You can also install the latest development version using the following command:

pip install git+https://github.com/parafoxia/opentriviadb

You may need to prefix these commands with a call to the Python interpreter depending on your OS and Python configuration.

Usage

Before you can pull questions from the API, you first need to create a client:

from opentriviadb import Client

client = Client()

# You can also use the client via a context manager.
async with Client() as client:
    ...

To prevent duplicate questions being pulled, request a session token:

await client.request_token()

You can now run a round of trivia! Questions are yielded one at a time when needed, though you can use the list() built-in function if you need them all available at once. See the Question docs for more information.

async for q in client.round():
    # Yields `Question` objects.
    ...

Once you're done, you need to tear the client down:

await client.teardown()

If you use the client via the context manager, the teardown method is called automatically.

Contributing

Contributions are very much welcome! To get started:

License

The OpenTriviaDB module for Python is licensed under the BSD 3-Clause License.

Metadata

Release files for opentriviadb 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentriviadb 0.1.0
File Size Uploaded Provenance Actions
opentriviadb-0.1.0.tar.gz 9.5 kB Without provenance Details for opentriviadb-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentriviadb 0.1.0
File Interpreter ABI Platform Actions
opentriviadb-0.1.0-py3-none-any.whl Python 3 none any Details for opentriviadb-0.1.0-py3-none-any.whl

Total release size: 20.6 kB

Release files / opentriviadb-0.1.0.tar.gz

Download URL opentriviadb-0.1.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
736bf22b6bd36cc610f3b5efff817c9bb99e2efc282c216f28fddd9e741a030f
BLAKE2b-256 checksum
How to use checksums
80670dc3a990a7e39e62931c10ae5367437da77ff2822bcc400b67f417f1421e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Release files / opentriviadb-0.1.0-py3-none-any.whl

Download URL opentriviadb-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caced55629aba025816d5b70c25a74cfeec2f4f3d3dca982991dbd564ec6c7cd
BLAKE2b-256 checksum
How to use checksums
8293351d9242a18d81377af9d56361e9107b97eed96d5a3687776790724f9dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Security for opentriviadb 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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