Skip to main content

Python wrapper for the Open Trivia Database

Project description

python-open-trivia-database-wrapper

A Python wrapper for the Open Trivia Database API.

To intall the package, run the following command:

pip install python-open-trivia-database-wrapper

Usage

from opentdb.opentdb import openTriviaDB, Parameters

trivia = openTriviaDB()
response = trivia.get_questions(category=Parameters.Category.GENERAL_KNOWLEDGE, number_of_questions=1)

Example response:

    {
        "response_code": 0,
        "results": [
            {
                "category": "General Knowledge",
                "type": "multiple",
                "difficulty": "easy",
                "question": "What is the most common surname Wales?",
                "correct_answer": "Jones",
                "incorrect_answers": [
                    "Williams",
                    "Davies",
                    "Evans"
                ]
            }
        ]
    }

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.

open_trivia_database_wrapper-0.3.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file open_trivia_database_wrapper-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for open_trivia_database_wrapper-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49470401fe8e0fb8273e9b92bcb2b5bed088574f00bda4e56abd252995eeffe1
MD5 a3d75dfe53808036302f57dd49c73b1c
BLAKE2b-256 8cd72107ac18297fee9f6596b4900976c824fb9e8a243bc21d23fafc018d3321

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