Can't get my code to work

micksulleymicksulley Member
edited November 19 in Review my code

I just discovered OxfordDictionaries but I cannot get my code to work. I have registered and got an appID and key. My code fails with The debugged program raised the exception unhandled KeyError "'results'".
What have I done wrong? Thanks

here is the code -

from oxforddictionaries.words import OxfordDictionaries
app_id =
app_key =
o = OxfordDictionaries(app_id, app_key)
relax = o.get_synonyms("absorb").json()
print('relax = ', relax)
synonyms = relax['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['synonyms']
for s in range(10):
print(synonyms[s]['text'])

Tagged:

Comments

  • TaisFukushimaTaisFukushima Member, Administrator, Moderator admin
    edited November 19

    Hello @micksulley

    It seems that you are using a third-party library. We would like to inform you that we do not maintain it; therefore, we don't support it. It refers to the API's first version, hence is out of date.

    We would recommend to use our API Documentation as reference, you will see our code examples there.

    I hope it helps!

Sign In or Register to comment.