Skip to content
Permalink
a43b86e2ff
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (39 sloc) 1.41 KB
# Google API Key
AIzaSyArPcOPqon_MSxFKkB41qCexrCVZ5AHfoU
# Search Engine ID
001954664739637419008:prvczty2gta
# Functions
### getQuestion
- Input (category, difficulty, nrQuestions = 1, qSource = "opentDB")
To get a random category or difficulty ("" or "Any" or "Random")
Source can be: opentDB, Birthday, History or Quote
- Output (questionsSet)
A dictionary with the keys: Type, Question, A, B, C, D and corrAnswer all as string
If more than one question returns a list of dictionaries
### getCategories
- Input (onlyCategories = False, , nrCat = 0)
True returns categories without ID numbers
nrCat returns a set number of random categories
- Output (categories)
A list with the choosen number of categories
### getBirthday
- No Input
- Output
A dictionary of a radom birthday with the keys: Type, Name, Date, Question, corrAnswer all as string
### getHistory
- No Input
- Output
A dictionary of a radom birthday with the keys: Type, Event, Date, Question, corrAnswer all as string
### getQuote
- No Input
- Output
A dictionary of a radom birthday with the keys: Type, Name, Quote, Question, corrAnswer all as string
#### Error Codes
0 - There was an error opening the URL
1 - Error reading JSON data
2 - The number of questions requested not valid
3 - Category not valid
4 - Difficulty not valid
5 - No results were found
6 - Invalid parameter
7 - Token not found or all available question were used