Showing error code 403 "Authentication Failed"

I had been using a same set of python codes to connect to a json file using my Prototype Account Credentials and store it in the form of a nested dictionry List combintion. Later to extract the definition in my Study Project on NLP & POS-tagging.
The codes were running perfectly eversince giving Code 200. However from Last evening it is giving the above mention error -- *Showing error code 403 "Authentication Failed"

The codes which ran perfectly are herein under

for more information on how to install requests

http://docs.python-requests.org/en/master/user/install/#install

import requests
import json

TODO: replace with your own app_id and app_key

app_id = 'XXXXXXXX'
app_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
endpoint = "entries"
language = 'en-gb'
word_id = 'Ignominy'
fields = 'pronunciations'
strictMatch = 'false'
url = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + language + '/' + word_
id.lower() + '?fields=' + fields + '&strictMatch=' + strictMatch;
r = requests.get(url, headers = {'app_id': app_id, 'app_key': app_key})
print("code {}\n".format(r.status_code))
print("text \n" + r.text)
print("json \n" + json.dumps(r.json()))

The out shown recently are

code 403
text

Authentication failed

JSONDecodeError Traceback (most recent call last)
in
19 print("code {}\n".format(r.status_code))
20 print("text \n" + r.text)
---> 21 print("json \n" + json.dumps(r.json()))
~/conda/envs/python/lib/python3.6/site-packages/requests/models.py in json(se
lf, **kwargs)
896 # used.
897 pass
--> 898 return complexjson.loads(self.text, **kwargs)
899
900 @property
~/conda/envs/python/lib/python3.6/json/__init__.py in loads(s, encoding, cls,
object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
352 parse_int is None and parse_float is None and
353 parse_constant is None and object_pairs_hook is None and
not kw):
--> 354 return _default_decoder.decode(s)
355 if cls is None:
356 cls = JSONDecoder
~/conda/envs/python/lib/python3.6/json/decoder.py in decode(self, s, _w)
337
338 """
--> 339 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
340 end = _w(s, end).end()
341 if end != len(s):
~/conda/envs/python/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
355 obj, end = self.scan_once(s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) fr
om None
358 return obj, end
JSONDecodeError: Expecting value: line 1 column

Can anybody help it resolve for me. I have some timebound assignmnets in the course failing which will not be good for me.

Thanks & regards

SALIL RAY

Comments

  • SimoneSimone Administrator admin
    edited August 25

    Hi @ubanarjee
    Oh, let me see if I can find someone who can help - bear with me!
    In the meantime, please check our help with HTTP Status Codes - could it maybe be possible that you have reached your allowance, or that the key was incorrect?

  • SimoneSimone Administrator admin

    Hi again @ubanarjee

    I've just heard back from my colleagues in the technical team.

    Your code looks good, but because the URL used in it is hidden, they were not able to
    check if the problem is that you were trying to access an endpoint that is not available for your API plan.

    If you could please send me your app_id, my colleagues can check if you had already reached your monthly allowance, or if the endpoint you were trying to access is allowed. Once we've established this, we can investigate further if the problem persists.

    Please send me your app_id via private message, so it is not on visible on a public comment here.

Sign In or Register to comment.