How do I authenticate AccountAPI using wordnik-python3?

37 views
Skip to first unread message

Jodi Schneider

unread,
Apr 12, 2019, 11:27:39 AM4/12/19
to wordn...@googlegroups.com
Hi,

I can get definitions successfully, but I'm having difficulty authenticating the AccountAPI using wordnik-python3. I can set up AccountApi but when I call the authenticate method I receive a HTTP 403 error. I've checked my login details are correct, on both the website and with the Swagger JSON script. I ran the Wordnik test script and 19 of the 30 tests failed, including authenticate.

My code and error output are below. Does anyone have advice on what I may be doing wrong? 

Thanks!
-Jodi

######CODE######

apiKey = 'anonymizing'
client = swagger.ApiClient(apiKey, apiUrl)
USER = 'anonymizing'
PW =  'anonymizing'

account = AccountApi.AccountApi(client)
response = account.authenticate(USER, PW)

######OUTPUT######

Traceback (most recent call last):

  File "getlists.py", line 10, in <module>

    response = account.authenticate(USER, PW)

  File "/Users/jodi/projecteuler/wordnik/AccountApi.py", line 67, in authenticate

    postData, headerParams)

  File "/Users/jodi/projecteuler/wordnik/swagger.py", line 73, in callAPI

    request = urllib.request.urlopen(requestParams)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 222, in urlopen

    return opener.open(url, data, timeout)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 531, in open

    response = meth(req, response)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 641, in http_response

    'http', request, response, code, msg, hdrs)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 569, in error

    return self._call_chain(*args)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 503, in _call_chain

    result = func(*args)

  File "/Users/jodi/anaconda3/lib/python3.7/urllib/request.py", line 649, in http_error_default

    raise HTTPError(req.full_url, code, msg, hdrs, fp)

urllib.error.HTTPError: HTTP Error 403: Forbidden


Venky

unread,
Apr 12, 2019, 12:43:17 PM4/12/19
to Wordnik API
Hi

I am not very familiar with python. Quick question; is the 503 error in the Wordnik response?

The “http_error_default” is what is making me ask the question

Thanks


Reply all
Reply to author
Forward
0 new messages