orc server test

dev-linux
robo-bo 2 years ago
parent 159b144107
commit a9e553e61d

@ -432,6 +432,7 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
def do_GET(self): def do_GET(self):
try: try:
global gSettingsDict global gSettingsDict
self.timeout=gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"]
self.settimeout(gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"]) self.settimeout(gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"])
threading.current_thread().request = self threading.current_thread().request = self
self.OpenRPA = {} self.OpenRPA = {}
@ -522,7 +523,8 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
def do_POST(self): def do_POST(self):
try: try:
global gSettingsDict global gSettingsDict
self.settimeout(gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"]) self.timeout=gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"]
self.request.settimeout(gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"])
threading.current_thread().request = self threading.current_thread().request = self
lL = gSettingsDict["Logger"] lL = gSettingsDict["Logger"]
self.OpenRPA = {} self.OpenRPA = {}
@ -637,6 +639,8 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread.""" """Handle requests in a separate thread."""
def finish_request(self, request, client_address): def finish_request(self, request, client_address):
try: try:
global gSettingsDict
request.settimeout(gSettingsDict["ServerDict"]["RequestTimeoutSecFloat"])
# "super" can not be used because BaseServer is not created from object # "super" can not be used because BaseServer is not created from object
HTTPServer.finish_request(self, request, client_address) HTTPServer.finish_request(self, request, client_address)
except ConnectionResetError as e: except ConnectionResetError as e:

@ -1,5 +1,7 @@
import os, logging, datetime, sys import os, logging, datetime, sys
import schedule # https://schedule.readthedocs.io/en/stable/examples.html import schedule
from pyOpenRPA.Tools import CrossOS # https://schedule.readthedocs.io/en/stable/examples.html
# Technical def - return GSettings structure with examples # Technical def - return GSettings structure with examples
def __Create__(): def __Create__():
@ -340,7 +342,7 @@ def Create(inModeStr="BASIC", inLoggerLevel = None):
lL.setLevel(logging.INFO) lL.setLevel(logging.INFO)
# create the logging file handler # create the logging file handler
mRobotLoggerFH = logging.FileHandler( mRobotLoggerFH = logging.FileHandler(
os.path.normpath("Reports\\" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log")) CrossOS.PathStr("Reports\\" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log"))
mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) mRobotLoggerFH.setFormatter(mRobotLoggerFormatter)
# add handler to logger object # add handler to logger object

Loading…
Cancel
Save