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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.