Metadata-Version: 2.1
Name: trivia.py
Version: 1.0.4
Summary: A python wrapper for Open Trivia DB
Home-page: https://github.com/Epicyon-H/trivia.py
Author: Epicyon
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
Requires-Dist: aiohttp
Requires-Dist: aiodns

# trivia.py

An easy to use python api wrapper for [Open Trivia DB](https://opentdb.com/api_config.php)




# Installing

Python 3.6 or higher is required

```
pip install trivia.py
```




# Usage

```python
question(parameters)
```

**Parameters:**
- amount (*int*):
    The amount of questions you wish to request, defaults to 10

- category (*int*):
    The category you wish to request from (refer to table below for which number correlates to which category), defaults to `None` returning all categories.

| Int | Category                              |
| --- |:------------------------------------- |
| 0   | All categories                        |
| 1   | General Knowledge                     |
| 2   | Entertainment: Books                  |
| 3   | Entertainment: Film                   |
| 4   | Entertainment: Music                  |
| 5   | Entertainment: Musicals & Theatres    |
| 6   | Entertainment: Television             |
| 7   | Entertainment: Video Games            |
| 8   | Entertainment: Board Games            |
| 9   | Science & Nature                      |
| 10  | Science: Computers                    |
| 11  | Science: Mathematics                  |
| 12  | Mythology                             |
| 13  | Sports                                |
| 14  | Geography                             |
| 15  | History                               |
| 16  | Politics                              |
| 17  | Art                                   |
| 18  | Celebrities                           |
| 19  | Animals                               |
| 20  | Vehicles                              |
| 21  | Entertainment: Comics                 |
| 22  | Science: Gadgets                      |
| 23  | Entertainment: Japanese Anime & Manga |
| 24  | Entertainment: Cartoon & Animations   |

- difficulty (*str*):
    The difficulty of the questions, can be `easy`, `medium`, or `hard`. Defaults to `None` returning all difficulties. 

- quizType (*str*):
    The type of questions, can be `multiple` (multiple choice questions), or `boolean` (true/false questions). Defaults to `None` returning all questions types. 


**Return:**

Return a list of dicts which contains the keys below
- category (*str*):
    The category the question comes from.

- type (*str*):
    The type of question (multiple, or boolean).

- difficulty (*str*):
    The difficulty of the question.

- question (*str*):
    The text of the question.

- correct_answer (*str*):
    The correct answer.

- incorrect_answer (*list*):
    List of strings of all the incorrect answers.




# Examples

**Basic code example**
```python
from trivia import trivia

questions = trivia.question(amount=1, category=2, difficulty='easy', quizType='boolean')
```


**An example of the return**
```python
[{
    'category': 'Entertainment: Books', 
    'type': 'boolean', 
    'difficulty': 'easy', 
    'question': 'The Harry Potter series of books, combined, are over 1,000,000 words in length.', 
    'correct_answer': 'True', 
    'incorrect_answers': ['False']
}]
```

