Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_zdict_dir_if_not_exists():
if not os.path.isdir(constants.BASE_DIR):
os.mkdir(constants.BASE_DIR)
def create_zdict_dir_if_not_exists():
if not os.path.isdir(constants.BASE_DIR):
os.mkdir(constants.BASE_DIR)
def create_zdict_dir_if_not_exists():
if not os.path.isdir(constants.BASE_DIR):
os.mkdir(constants.BASE_DIR)
def create_zdict_dir_if_not_exists():
if not os.path.isdir(constants.BASE_DIR):
os.mkdir(constants.BASE_DIR)
import re
from zdict.constants import BASE_DIR
from zdict.dictionary import DictBase
from zdict.exceptions import NotFoundError, QueryError, APIKeyError
from zdict.models import Record
class OxfordDictionary(DictBase):
"""
Docs:
* https://developer.oxforddictionaries.com/documentation/
"""
KEY_FILE = os.path.join(BASE_DIR, 'oxford.key')
API = 'https://od-api.oxforddictionaries.com/api/v1/entries/en/{word}'
# https://developer.oxforddictionaries.com/documentation/response-codes
status_code = {
200: 'Success!',
400: 'The request was invalid or cannot be otherwise served.',
403: 'The request failed due to invalid credentials.',
404: 'No entry is found.',
500: 'Something is broken. Please contact the Oxford Dictionaries '
'API team to investigate.',
502: 'Oxford Dictionaries API is down or being upgraded.',
503: 'The Oxford Dictionaries API servers are up, but overloaded '
'with requests. Please try again later.',
504: 'The Oxford Dictionaries API servers are up, but the request '
'couldn’t be serviced due to some failure within our stack. '