Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

error 403 for authentication using Pyton

tushar Singh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2022

Hi All,

I am using the below code to fetch project details from Jira using Python.

jira_1 = Jira(
url='https://agile-jira.pearson.com/',
username='',
password='',
cloud=True)

jira_1.project('ROY')

And then i get the following errors.

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
~\Anaconda3\lib\site-packages\atlassian\rest_client.py in raise_for_status(self, response)
    393             try:
--> 394                 j = response.json()
    395                 error_msg = "\n".join(j["errorMessages"] + [k + ": " + v for k, v in j["errors"].items()])

~\Anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
    899                     pass
--> 900         return complexjson.loads(self.text, **kwargs)
    901 

~\Anaconda3\lib\site-packages\simplejson\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    524             and not use_decimal and not kw):
--> 525         return _default_decoder.decode(s)
    526     if cls is None:

~\Anaconda3\lib\site-packages\simplejson\decoder.py in decode(self, s, _w, _PY3)
    369             s = str(s, self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()

~\Anaconda3\lib\site-packages\simplejson\decoder.py in raw_decode(self, s, idx, _w, _PY3)
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 12 column 1 (char 11)

During handling of the above exception, another exception occurred:

HTTPError                                 Traceback (most recent call last)
<ipython-input-55-62b37bf0b5d5> in <module>
----> 1 jira_1.project('ROY')

~\Anaconda3\lib\site-packages\atlassian\jira.py in project(self, key, expand)
   1807         base_url = self.resource_url("project")
   1808         url = "{base_url}/{key}".format(base_url=base_url, key=key)
-> 1809         return self.get(url, params=params)
   1810 
   1811     def get_project(self, key, expand=None):

~\Anaconda3\lib\site-packages\atlassian\rest_client.py in get(self, path, data, flags, params, headers, not_json_response, trailing, absolute, advanced_mode)
    268         :return:
    269         """
--> 270         response = self.request(    271             "GET",
    272             path=path,

~\Anaconda3\lib\site-packages\atlassian\rest_client.py in request(self, method, path, data, json, flags, params, headers, files, trailing, absolute)
    240             return response
    241 
--> 242         self.raise_for_status(response)
    243         return response
    244 

~\Anaconda3\lib\site-packages\atlassian\rest_client.py in raise_for_status(self, response)
    395                 error_msg = "\n".join(j["errorMessages"] + [k + ": " + v for k, v in j["errors"].items()])
    396             except Exception:
--> 397                 response.raise_for_status()
    398             else:
    399                 raise HTTPError(error_msg, response=response)

~\Anaconda3\lib\site-packages\requests\models.py in raise_for_status(self)
    941 
    942         if http_error_msg:
--> 943             raise HTTPError(http_error_msg, response=self)
    944 
    945     def close(self):

HTTPError: 403 Client Error:  for url: https://agile-jira.pearson.com/rest/api/2/project/ROY

Can somebody please help me with the same? How to resolve this? It will be really helpful!

You can also contact me at - tushar.24.ts@gmail.com for the solutions.

Thanks,

Tushar Singh.

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events