Forums

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

Random 401 - Unauthorized; error while loading this page error.

Prashant Gandhi
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!
November 12, 2018

All, 

I'm getting randon 401 - Unauthorized; error while loading this page error. Few API request go well , and then starts giving error. I have reproduced this in a small program. Please help ! Please let me know if there is anything wrong that I'm doing, this same code has been working fine for months now. All of a sudden started giving errors since yesterday. Debugging shows that I'm getting 401 - Unauthorized; error while loading this page error at line of code which is Bold. I'm using Python 3.6.

 

import http.client
import json
from threading import Thread

def testing(threadname):
loop = 0
while loop < 100:
loop = loop + 1
retries = 0
while retries < 10:
retries = retries + 1
try:
conn = http.client.HTTPSConnection("XXXXXXXXXXXXXXX.atlassian.net")
headers = {
'authorization': "Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
'cache-control': "no-cache"
}
conn.request("GET", "/rest/api/2/issue/ABC-111/", headers=headers)
res = conn.getresponse()
data = res.read()
jsonstr = data.decode("utf-8")
jsondata = json.loads(jsonstr)
print(threadname,loop,jsondata['fields']['created'])
except Exception as exp:
print("Retrying ...... ",threadname,loop,retries)
continue
break

issuecounter = 1
thread_id = 1

while(issuecounter < 11):
t = Thread(target=testing, name = str(thread_id),args=(thread_id,))
t.start()
issuecounter = issuecounter+1
thread_id = thread_id+1

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events