From ca8fcbdca985968b626262dd7c54675f7fc5569d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 25 Nov 2024 14:42:21 +0800 Subject: [PATCH] bugfix --- ahserver/globalEnv.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ahserver/globalEnv.py b/ahserver/globalEnv.py index a20685c..77e5bbe 100644 --- a/ahserver/globalEnv.py +++ b/ahserver/globalEnv.py @@ -28,6 +28,7 @@ from appPublic.unicoding import unicoding,uDict,uObject from appPublic.Singleton import SingletonDecorator from appPublic.rc4 import password from appPublic.registerfunction import RegisterFunction +from appPublic.httpclient import HttpClient from sqlor.dbpools import DBPools,runSQL,runSQLPaging from sqlor.filter import DBFilter, default_filterjson @@ -41,6 +42,12 @@ from .filetest import current_fileno from .filestorage import FileStorage from .serverenv import ServerEnv +def basic_auth_headers(user, passwd): + ba = BasicAuth(login=user, password=passwd) + return { + "Authorization":ba.encode() + } + def data2xlsx(rows,headers=None): wb = Workbook() ws = wb.active @@ -211,6 +218,8 @@ def initEnv(): g.save_file = save_file g.realpath = realpath g.format_exc = format_exc + g.basic_auth_headers = basic_auth_headers + g.HttpClient = HttpClient g.rfexe = RegisterFunction().exe def set_builtins():