Ejemplo n.º 1
0
def get_mw_synonym(word):
    keys = get_keys()

    url = 'https://www.dictionaryapi.com/api/v3/references/thesaurus/json/{}?key={}'.format(
        word, keys['mw_thesaurus_key'])

    response = requests.request("GET", url)
    res_json = json.loads(response.text)
    return res_json
Ejemplo n.º 2
0
def get_mw_definition(word):
    keys = get_keys()
    # pdb.set_trace()

    url = 'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{}?key={}'.format(
        word, keys['mw_dict_key'])

    response = requests.request("GET", url)
    res_text = response.text
    return res_text
Ejemplo n.º 3
0
def get_definition(word):
    keys = get_keys()

    url = "https://wordsapiv1.p.rapidapi.com/words/{}/definitions".format(word)

    headers = {
        'x-rapidapi-host': "wordsapiv1.p.rapidapi.com",
        'x-rapidapi-key': "{}".format(keys['rapid_key'])
    }

    response = requests.request("GET", url, headers=headers)
    res_text = response.text
    return res_text
Ejemplo n.º 4
0
import requests

from config.keys import get_keys

keys = get_keys()
print(keys)

url = "https://wordsapiv1.p.rapidapi.com/words/cow/definitions"

headers = {
    'x-rapidapi-host': "wordsapiv1.p.rapidapi.com",
    'x-rapidapi-key': "{}".format(keys['rapid_key'])
}

response = requests.request("GET", url, headers=headers)

print(response.text)