22 lines
557 B
Python
22 lines
557 B
Python
import requests
|
|
import json
|
|
|
|
from . import API_URL
|
|
from biopro.server._identify import get_api_jwt, set_api_jwt
|
|
|
|
class AuthAPI():
|
|
_jwt_key = ''
|
|
|
|
@classmethod
|
|
def set_key(cls):
|
|
try:
|
|
ret = requests.get(API_URL + 'public/auth/get_cookie')
|
|
|
|
if ret.status_code == 200:
|
|
cls._jwt_key = 'Bearer ' + ret.text
|
|
except requests.exceptions.ConnectionError as e:
|
|
print('auth setup fail', e)
|
|
|
|
@classmethod
|
|
def get_key(cls):
|
|
return { 'Authorization': cls._jwt_key } |