I was off for some time, but I have an update.
What we were actually doing is getting results of several "show task" calls in a loop and then logout.
Looks like a timing issue. After setting additional 2 sec of time.sleep to logout api call issue is gone. Previously when logout was called straight after last 'show task' all of them were failing with the same "no scope" message. I am attaching output, maybe you can find something interesting here or it will be useful for someone in the future. I have another issue, but I will open separate post for that.