Files
controller-wisetopdataserver/python/biopro/server/_identify.py
T
2022-04-25 10:36:02 +08:00

26 lines
611 B
Python

import uuid
import requests
API_SERVER_HOST = 'http://192.168.0.192'
API_SERVER_PORT = 3000
# API_SERVER_AUTH_TOKEN = requests.get(API_SERVER_HOST + ':' + str(API_SERVER_PORT) + '/public/auth/get_cookie').text
_jwt = None
def controller_device_id() -> str:
### device ID
f = open("/sys/class/net/eth0/address", "r")
mac = f.read()[:-1]
return mac
def get_api_jwt() -> str:
global _jwt
return _jwt
def set_api_jwt(jwt = None) -> str:
### jwt
global _jwt
if jwt is not None:
_jwt = jwt
print('set_api_jwt', _jwt)
print('get_api_jwt', get_api_jwt())