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.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for open_trivia_database_wrapper-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c4c09163fb0fe6763736349dfa423a790f0ea7033a4bbf1f989c7401a6ba3b
MD5 8b16c5370c02452961ef7634648c10de
BLAKE2b-256 a761dbe612a74910a6e52b3dfd7fa2b8f9b065ddb3637ecc3000f5cace2774ac

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