From 35e7fc09c1901fab242385868ad7eb3995c59b0b Mon Sep 17 00:00:00 2001 From: abdulaziz ali hamed al badi <71528@omantel.om> Date: Wed, 1 May 2024 10:49:34 +0400 Subject: [PATCH 1/7] latest changes --- .gitignore | 2 + ReadMe.txt | 16 +++++ error_log.log | 174 ++++++++++++++++++++++++++++++++++++++++++++++ logic.py | 83 ++++++++++++++++++++++ main.py | 63 +++++++++++++++++ measurementAPI.py | 55 +++++++++++++++ measurements.db | Bin 0 -> 12288 bytes testing.py | 39 +++++++++++ 8 files changed, 432 insertions(+) create mode 100644 .gitignore create mode 100644 ReadMe.txt create mode 100644 error_log.log create mode 100644 logic.py create mode 100644 main.py create mode 100644 measurementAPI.py create mode 100644 measurements.db create mode 100644 testing.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d63adf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +**/__pycache__ diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..4d096ec --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,16 @@ + Run and Test the Application +Make sure you have the SQLite library and CherryPy installed, and then run the application. You can test it using curl or any similar tool: + +To convert and store an input: +bash +Copy code +curl "http://localhost:8080/convert?input_str=abc" +To retrieve the conversion history: +bash +Copy code +curl "http://localhost:8080/history" +Explanation of the Code +Modular Design: The conversion logic is separated into its own file (conversion_logic.py), keeping the conversion function isolated from the web server logic. +Database Operations: The application handles all database interactions such as connecting, creating tables, inserting records, and fetching history directly in main.py, interfacing with the database using SQLite. +CherryPy Setup: The application exposes two endpoints: one for converting strings and storing the results (convert) and another for retrieving the conversion history (history). +This setup maintains a clean separation between the conversion logic and the API/web server logic, making it easier to manage and extend each part of your application independently. \ No newline at end of file diff --git a/error_log.log b/error_log.log new file mode 100644 index 0000000..9059824 --- /dev/null +++ b/error_log.log @@ -0,0 +1,174 @@ +2024-05-01 08:37:39,743:INFO:[01/May/2024:08:37:39] ENGINE Listening for SIGTERM. +2024-05-01 08:37:39,743:INFO:[01/May/2024:08:37:39] ENGINE Bus STARTING +2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Listening for SIGTERM. +2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Bus STARTING +2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 08:37:39,985:INFO:[01/May/2024:08:37:39] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 08:37:40,015:INFO:[01/May/2024:08:37:40] ENGINE Bus STARTED +2024-05-01 08:37:40,019:ERROR:[01/May/2024:08:37:40] ENGINE Error in HTTP server: shutting down +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 225, in _start_http_thread + self.httpserver.start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cheroot\server.py", line 1840, in start + self.prepare() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cheroot\server.py", line 1795, in prepare + raise socket.error(msg) +OSError: No socket could be created -- (('0.0.0.0', 8080): [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) + +2024-05-01 08:37:40,024:INFO:[01/May/2024:08:37:40] ENGINE Bus STOPPING +2024-05-01 08:37:40,025:INFO:[01/May/2024:08:37:40] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-01 08:37:40,027:INFO:[01/May/2024:08:37:40] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 08:37:40,028:INFO:[01/May/2024:08:37:40] ENGINE Bus STOPPED +2024-05-01 08:37:40,029:INFO:[01/May/2024:08:37:40] ENGINE Bus EXITING +2024-05-01 08:37:40,029:INFO:[01/May/2024:08:37:40] ENGINE Bus EXITED +2024-05-01 08:37:47,835:INFO:[01/May/2024:08:37:47] ENGINE Listening for SIGTERM. +2024-05-01 08:37:47,835:INFO:[01/May/2024:08:37:47] ENGINE Bus STARTING +2024-05-01 08:37:47,842:INFO:[01/May/2024:08:37:47] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 08:37:49,057:ERROR:[01/May/2024:08:37:49] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-01 08:37:49,057:ERROR:[01/May/2024:08:37:49] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE Bus STOPPING +2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 08:37:49,066:INFO:[01/May/2024:08:37:49] ENGINE Bus STOPPED +2024-05-01 08:37:49,066:INFO:[01/May/2024:08:37:49] ENGINE Bus EXITING +2024-05-01 08:37:49,067:INFO:[01/May/2024:08:37:49] ENGINE Bus EXITED +2024-05-01 08:38:10,145:INFO:[01/May/2024:08:38:10] ENGINE Listening for SIGTERM. +2024-05-01 08:38:10,145:INFO:[01/May/2024:08:38:10] ENGINE Bus STARTING +2024-05-01 08:38:10,159:INFO:[01/May/2024:08:38:10] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 08:38:11,199:ERROR:[01/May/2024:08:38:11] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-01 08:38:11,202:ERROR:[01/May/2024:08:38:11] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE Bus STOPPING +2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus STOPPED +2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus EXITING +2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus EXITED +2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\api.py changed. +2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Bus STOPPING +2024-05-01 08:38:24,512:INFO:[01/May/2024:08:38:24] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 08:38:24,512:INFO:[01/May/2024:08:38:24] ENGINE Bus STOPPED +2024-05-01 08:38:24,513:INFO:[01/May/2024:08:38:24] ENGINE Bus EXITING +2024-05-01 08:38:24,513:INFO:[01/May/2024:08:38:24] ENGINE Bus EXITED +2024-05-01 08:38:24,603:INFO:[01/May/2024:08:38:24] ENGINE Waiting for child threads to terminate... +2024-05-01 08:38:24,603:INFO:[01/May/2024:08:38:24] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/api.py +2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Listening for SIGTERM. +2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Bus STARTING +2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 08:55:43,292:INFO:[01/May/2024:08:55:43] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 08:55:43,292:INFO:[01/May/2024:08:55:43] ENGINE Bus STARTED +2024-05-01 08:55:50,245:INFO:127.0.0.1 - - [01/May/2024:08:55:50] "GET / HTTP/1.1" 404 1518 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 08:55:53,875:INFO:127.0.0.1 - - [01/May/2024:08:55:53] "GET / HTTP/1.1" 404 1518 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 08:56:13,884:INFO:127.0.0.1 - - [01/May/2024:08:56:13] "GET /convert?input_str=ab HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 08:57:13,264:INFO:127.0.0.1 - - [01/May/2024:08:57:13] "GET /history HTTP/1.1" 200 82 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 09:22:25,922:INFO:[01/May/2024:09:22:25] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 09:22:25,923:INFO:[01/May/2024:09:22:25] ENGINE Bus STOPPING +2024-05-01 09:22:26,063:INFO:[01/May/2024:09:22:26] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 09:22:26,063:INFO:[01/May/2024:09:22:26] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 09:22:26,064:INFO:[01/May/2024:09:22:26] ENGINE Bus STOPPED +2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Bus EXITING +2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Bus EXITED +2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Waiting for child threads to terminate... +2024-05-01 09:22:34,672:INFO:[01/May/2024:09:22:34] ENGINE Listening for SIGTERM. +2024-05-01 09:22:34,672:INFO:[01/May/2024:09:22:34] ENGINE Bus STARTING +2024-05-01 09:22:34,673:INFO:[01/May/2024:09:22:34] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 09:22:34,887:INFO:[01/May/2024:09:22:34] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 09:22:34,887:INFO:[01/May/2024:09:22:34] ENGINE Bus STARTED +2024-05-01 09:23:11,857:INFO:[01/May/2024:09:23:11] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 09:23:11,857:INFO:[01/May/2024:09:23:11] ENGINE Bus STOPPING +2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE Bus STOPPED +2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Bus EXITING +2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Bus EXITED +2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Waiting for child threads to terminate... +2024-05-01 09:34:23,896:INFO:[01/May/2024:09:34:23] ENGINE Listening for SIGTERM. +2024-05-01 09:34:23,896:INFO:[01/May/2024:09:34:23] ENGINE Bus STARTING +2024-05-01 09:34:23,904:INFO:[01/May/2024:09:34:23] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 09:34:24,132:INFO:[01/May/2024:09:34:24] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 09:34:24,132:INFO:[01/May/2024:09:34:24] ENGINE Bus STARTED +2024-05-01 09:34:36,758:INFO:127.0.0.1 - - [01/May/2024:09:34:36] "GET /history HTTP/1.1" 200 82 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 09:35:07,609:INFO:127.0.0.1 - - [01/May/2024:09:35:07] "GET /convert?input_str=baa HTTP/1.1" 200 31 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 09:35:36,876:INFO:[01/May/2024:09:35:36] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 09:35:36,876:INFO:[01/May/2024:09:35:36] ENGINE Bus STOPPING +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus STOPPED +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus EXITING +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus EXITED +2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Waiting for child threads to terminate... +2024-05-01 10:45:20,667:INFO:[01/May/2024:10:45:20] ENGINE Listening for SIGTERM. +2024-05-01 10:45:20,667:INFO:[01/May/2024:10:45:20] ENGINE Bus STARTING +2024-05-01 10:45:20,676:INFO:[01/May/2024:10:45:20] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 10:45:20,895:INFO:[01/May/2024:10:45:20] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 10:45:20,895:INFO:[01/May/2024:10:45:20] ENGINE Bus STARTED +2024-05-01 10:45:32,076:INFO:127.0.0.1 - - [01/May/2024:10:45:32] "GET /convert?input_str=baa HTTP/1.1" 200 31 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-01 10:45:40,238:INFO:[01/May/2024:10:45:40] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 10:45:40,238:INFO:[01/May/2024:10:45:40] ENGINE Bus STOPPING +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus STOPPED +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITING +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITED +2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Waiting for child threads to terminate... diff --git a/logic.py b/logic.py new file mode 100644 index 0000000..5f39264 --- /dev/null +++ b/logic.py @@ -0,0 +1,83 @@ +#import string + + + + +def convert_measurements(input_str): #function to convert input into ints + """ + + """ + input_str = input_str.lower() # convert any uppercase letter into lowercase for easier processing + mainList=list() #creating a list to store the values + def Char_To_Num(letter): + if letter!="_": #convert letters to ascsi except underscore + return(ord(letter)-96) + else: + return 0 + + inputLength = len(input_str) + + if inputLength==1: + mainList.append(Char_To_Num(input_str[0])) #if there is only one value in the list return the value of it + return mainList + + elif inputLength<=0: + return "Invalid input" #if there is no input return invalid input + + else: #this is where the main logic is processed + counter=0 #i + while(True): + if counter>=inputLength: + break + else: + steps=0 #resets the cycle to 0 + while(input_str[counter]=='z'): #if the first letter is Z use it to to count the number of steps, we start with the Z special cases , first while loop is for the cycling + steps+=Char_To_Num(input_str[counter]) + counter+=1 + steps += Char_To_Num(input_str[counter]) + + if steps==0: + mainList.append(0) #underscore case + break + + indexSum=0 + + + for d in range(steps): #counts the number of steps to count to process them and adding the values + counter+=1 + if counter>=inputLength: + break + + while(input_str[counter]=='z'): #2nd Z case, if there is multiple Z's in the same cycle + indexSum+=Char_To_Num(input_str[counter]) + counter+=1 + + indexSum+=Char_To_Num(input_str[counter]) + + counter+=1 + mainList.append(indexSum) + + return mainList + + +print(convert_measurements("za_a_a_a_a_a_a_a_a_a_a_a_a_azaaa")) +print(convert_measurements("zza_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_")) +print(convert_measurements("dz_a_a")) +print(convert_measurements("azza")) +print(convert_measurements("dz_a_aazzaaa")) +print(convert_measurements("abbcc")) +print(convert_measurements("a")) +print(convert_measurements("aa")) +print(convert_measurements("a_")) +print(convert_measurements("abcdabcdab")) +print(convert_measurements("abcdabcdab_asas")) +print(convert_measurements("_")) +print(convert_measurements("_ad")) +print(convert_measurements("a_")) +print(convert_measurements("_______")) +print(convert_measurements("aaa")) + + + +# if z inside a cycle dont count step only value +# if z is the first letter that indicates a cycle add the number next to it to the number of steps \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..0a7b84f --- /dev/null +++ b/main.py @@ -0,0 +1,63 @@ +import cherrypy +import sqlite3 +from logic import convert_measurements # Ensure this module and function are correctly implemented. +import logging + +from measurementAPI import MeasurementAPI + +DATABASE_NAME = "measurements.db" +""" +class MeasurementAPI: + def __init__(self): + self.create_table() + + def connect(self): + return sqlite3.connect(DATABASE_NAME) + + def create_table(self): + with self.connect() as conn: + conn.execute(''' + CREATE TABLE IF NOT EXISTS history ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + input_str TEXT NOT NULL, + output_str TEXT NOT NULL + ); + ''') + + def add_to_history(self, input_str, output_str): + try: + with self.connect() as conn: + conn.execute('INSERT INTO history (input_str, output_str) VALUES (?, ?)', (input_str, output_str)) + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + # Optionally, re-raise or handle the error differently + raise + + def get_history(self): + try: + with self.connect() as conn: + cursor = conn.execute('SELECT input_str, output_str FROM history') + return [{"input": row[0], "output": row[1]} for row in cursor.fetchall()] + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + return [] + + @cherrypy.expose + @cherrypy.tools.json_out() + def convert(self, input_str=""): + if not input_str: + return {"error": "No input provided"} + result = convert_measurements(input_str) + self.add_to_history(input_str, str(result)) + return {"input": input_str, "output": result} + + @cherrypy.expose + @cherrypy.tools.json_out() + def history(self): + return {"history": self.get_history()} +""" +if __name__ == '__main__': + logging.basicConfig(filename='error_log.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') + cherrypy.config.update({'server.socket_host': '0.0.0.0', 'server.socket_port': 8080}) + + cherrypy.quickstart(MeasurementAPI(), '/') diff --git a/measurementAPI.py b/measurementAPI.py new file mode 100644 index 0000000..9cab368 --- /dev/null +++ b/measurementAPI.py @@ -0,0 +1,55 @@ +import cherrypy +import sqlite3 +from logic import convert_measurements # Ensure this module and function are correctly implemented. +import logging + +DATABASE_NAME = "measurements.db" + +class MeasurementAPI: + def __init__(self): + self.create_table() + + def connect(self): + return sqlite3.connect(DATABASE_NAME) + + def create_table(self): + with self.connect() as conn: + conn.execute(''' + CREATE TABLE IF NOT EXISTS history ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + input_str TEXT NOT NULL, + output_str TEXT NOT NULL + ); + ''') + + def add_to_history(self, input_str, output_str): + try: + with self.connect() as conn: + conn.execute('INSERT INTO history (input_str, output_str) VALUES (?, ?)', (input_str, output_str)) + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + # Optionally, re-raise or handle the error differently + raise + + def get_history(self): + try: + with self.connect() as conn: + cursor = conn.execute('SELECT input_str, output_str FROM history') + return [{"input": row[0], "output": row[1]} for row in cursor.fetchall()] + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + return [] + + @cherrypy.expose + @cherrypy.tools.json_out() + def convert(self, input_str=""): + if not input_str: + return {"error": "No input provided"} + result = convert_measurements(input_str) + self.add_to_history(input_str, str(result)) + return {"input": input_str, "output": result} + + @cherrypy.expose + @cherrypy.tools.json_out() + def history(self): + return {"history": self.get_history()} \ No newline at end of file diff --git a/measurements.db b/measurements.db new file mode 100644 index 0000000000000000000000000000000000000000..a12d292e77129ffb7df4745bdb0f9453d1cf6bf6 GIT binary patch literal 12288 zcmeI&O-jQ+6bJB`Bvq_vlrFmHW>(VD;=*3QD1#K!w8kk~N+}bKSZLFaOcyT2Q+W)* ztp{+e2XIna#2RqpLgfF*d_CU0#cwx|^E0=vLUuEn4y9sMvO_2(hl~+IGJ2SLEQ9Ke zwLIuGIsX(HvL8Ke=_+IUnb>=JLO=il5P$##AOHafKmY;|fB*!3NuX)0<;!K-Rx%ib z@noPMxV<=>%);nu^=KaZ+!34!=g8%3rM4K!VOY^OOZOLaJzpr$hs?a^Z9i6{>D^*6 zzVuimSux8}qJPb5p5Q0kXHCCWclTjJ($=lqrpNRc#zuGT)gMa`8AOHafKmY;|fB*y_009U<;O`4$EsNxG zfs~ztZr1$VZx|NY&B-81(|J0OooY9E|5N*o=nnw_2tWV=5P$##AOHafKmY;|fWZF| N*raBGE`C$6J^&&UZL Date: Wed, 1 May 2024 11:04:10 +0400 Subject: [PATCH 2/7] Refactored the code by creating services and controller dirs --- .../measurement_controller.py | 5 +- error_log.log | 56 +++++++++++++++++++ main.py | 54 +----------------- logic.py => services/measurement_service.py | 43 +++++++------- 4 files changed, 80 insertions(+), 78 deletions(-) rename measurementAPI.py => controller/measurement_controller.py (90%) rename logic.py => services/measurement_service.py (74%) diff --git a/measurementAPI.py b/controller/measurement_controller.py similarity index 90% rename from measurementAPI.py rename to controller/measurement_controller.py index 9cab368..b0dc452 100644 --- a/measurementAPI.py +++ b/controller/measurement_controller.py @@ -1,6 +1,6 @@ import cherrypy import sqlite3 -from logic import convert_measurements # Ensure this module and function are correctly implemented. +from services.measurement_service import convert_measurements # Ensure this module and function are correctly implemented. import logging DATABASE_NAME = "measurements.db" @@ -52,4 +52,5 @@ def convert(self, input_str=""): @cherrypy.expose @cherrypy.tools.json_out() def history(self): - return {"history": self.get_history()} \ No newline at end of file + return {"history": self.get_history()} + \ No newline at end of file diff --git a/error_log.log b/error_log.log index 9059824..72231d3 100644 --- a/error_log.log +++ b/error_log.log @@ -172,3 +172,59 @@ cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0. 2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITING 2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITED 2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Waiting for child threads to terminate... +2024-05-01 10:55:58,090:INFO:[01/May/2024:10:55:58] ENGINE Listening for SIGTERM. +2024-05-01 10:55:58,090:INFO:[01/May/2024:10:55:58] ENGINE Bus STARTING +2024-05-01 10:55:58,096:INFO:[01/May/2024:10:55:58] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 10:55:58,305:INFO:[01/May/2024:10:55:58] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 10:55:58,305:INFO:[01/May/2024:10:55:58] ENGINE Bus STARTED +2024-05-01 10:56:07,675:INFO:127.0.0.1 - - [01/May/2024:10:56:07] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 10:56:14,383:INFO:[01/May/2024:10:56:14] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 10:56:14,383:INFO:[01/May/2024:10:56:14] ENGINE Bus STOPPING +2024-05-01 10:56:14,515:INFO:[01/May/2024:10:56:14] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus STOPPED +2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus EXITING +2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus EXITED +2024-05-01 10:56:14,520:INFO:[01/May/2024:10:56:14] ENGINE Waiting for child threads to terminate... +2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Listening for SIGTERM. +2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Bus STARTING +2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 10:58:07,698:INFO:[01/May/2024:10:58:07] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 10:58:07,698:INFO:[01/May/2024:10:58:07] ENGINE Bus STARTED +2024-05-01 10:58:17,296:INFO:127.0.0.1 - - [01/May/2024:10:58:17] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 10:58:33,721:INFO:[01/May/2024:10:58:33] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 10:58:33,721:INFO:[01/May/2024:10:58:33] ENGINE Bus STOPPING +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus STOPPED +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus EXITING +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus EXITED +2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Waiting for child threads to terminate... +2024-05-01 11:01:49,983:INFO:[01/May/2024:11:01:49] ENGINE Listening for SIGTERM. +2024-05-01 11:01:49,983:INFO:[01/May/2024:11:01:49] ENGINE Bus STARTING +2024-05-01 11:01:49,987:INFO:[01/May/2024:11:01:49] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:01:50,207:INFO:[01/May/2024:11:01:50] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:01:50,207:INFO:[01/May/2024:11:01:50] ENGINE Bus STARTED +2024-05-01 11:02:11,639:INFO:127.0.0.1 - - [01/May/2024:11:02:11] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 11:02:19,129:INFO:[01/May/2024:11:02:19] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 11:02:19,129:INFO:[01/May/2024:11:02:19] ENGINE Bus STOPPING +2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE Bus STOPPED +2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Bus EXITING +2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Bus EXITED +2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Waiting for child threads to terminate... +2024-05-01 11:03:16,652:INFO:[01/May/2024:11:03:16] ENGINE Listening for SIGTERM. +2024-05-01 11:03:16,655:INFO:[01/May/2024:11:03:16] ENGINE Bus STARTING +2024-05-01 11:03:16,657:INFO:[01/May/2024:11:03:16] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:03:16,883:INFO:[01/May/2024:11:03:16] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:03:16,883:INFO:[01/May/2024:11:03:16] ENGINE Bus STARTED +2024-05-01 11:03:31,558:INFO:127.0.0.1 - - [01/May/2024:11:03:31] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 11:03:37,780:INFO:[01/May/2024:11:03:37] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 11:03:37,795:INFO:[01/May/2024:11:03:37] ENGINE Bus STOPPING +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus STOPPED +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITING +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITED +2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Waiting for child threads to terminate... diff --git a/main.py b/main.py index 0a7b84f..da60cc6 100644 --- a/main.py +++ b/main.py @@ -1,61 +1,9 @@ import cherrypy -import sqlite3 -from logic import convert_measurements # Ensure this module and function are correctly implemented. import logging -from measurementAPI import MeasurementAPI +from controller.measurement_controller import MeasurementAPI -DATABASE_NAME = "measurements.db" -""" -class MeasurementAPI: - def __init__(self): - self.create_table() - def connect(self): - return sqlite3.connect(DATABASE_NAME) - - def create_table(self): - with self.connect() as conn: - conn.execute(''' - CREATE TABLE IF NOT EXISTS history ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - input_str TEXT NOT NULL, - output_str TEXT NOT NULL - ); - ''') - - def add_to_history(self, input_str, output_str): - try: - with self.connect() as conn: - conn.execute('INSERT INTO history (input_str, output_str) VALUES (?, ?)', (input_str, output_str)) - except sqlite3.DatabaseError as e: - logging.error(f"Database error: {e}") - # Optionally, re-raise or handle the error differently - raise - - def get_history(self): - try: - with self.connect() as conn: - cursor = conn.execute('SELECT input_str, output_str FROM history') - return [{"input": row[0], "output": row[1]} for row in cursor.fetchall()] - except sqlite3.DatabaseError as e: - logging.error(f"Database error: {e}") - return [] - - @cherrypy.expose - @cherrypy.tools.json_out() - def convert(self, input_str=""): - if not input_str: - return {"error": "No input provided"} - result = convert_measurements(input_str) - self.add_to_history(input_str, str(result)) - return {"input": input_str, "output": result} - - @cherrypy.expose - @cherrypy.tools.json_out() - def history(self): - return {"history": self.get_history()} -""" if __name__ == '__main__': logging.basicConfig(filename='error_log.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') cherrypy.config.update({'server.socket_host': '0.0.0.0', 'server.socket_port': 8080}) diff --git a/logic.py b/services/measurement_service.py similarity index 74% rename from logic.py rename to services/measurement_service.py index 5f39264..2287570 100644 --- a/logic.py +++ b/services/measurement_service.py @@ -1,20 +1,16 @@ -#import string - - - - def convert_measurements(input_str): #function to convert input into ints """ """ - input_str = input_str.lower() # convert any uppercase letter into lowercase for easier processing - mainList=list() #creating a list to store the values def Char_To_Num(letter): if letter!="_": #convert letters to ascsi except underscore return(ord(letter)-96) else: return 0 + input_str = input_str.lower() # convert any uppercase letter into lowercase for easier processing + mainList=list() #creating a list to store the values + inputLength = len(input_str) if inputLength==1: @@ -60,22 +56,23 @@ def Char_To_Num(letter): return mainList -print(convert_measurements("za_a_a_a_a_a_a_a_a_a_a_a_a_azaaa")) -print(convert_measurements("zza_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_")) -print(convert_measurements("dz_a_a")) -print(convert_measurements("azza")) -print(convert_measurements("dz_a_aazzaaa")) -print(convert_measurements("abbcc")) -print(convert_measurements("a")) -print(convert_measurements("aa")) -print(convert_measurements("a_")) -print(convert_measurements("abcdabcdab")) -print(convert_measurements("abcdabcdab_asas")) -print(convert_measurements("_")) -print(convert_measurements("_ad")) -print(convert_measurements("a_")) -print(convert_measurements("_______")) -print(convert_measurements("aaa")) +if __name__ == "__main__": + print(convert_measurements("za_a_a_a_a_a_a_a_a_a_a_a_a_azaaa")) + print(convert_measurements("zza_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_a_")) + print(convert_measurements("dz_a_a")) + print(convert_measurements("azza")) + print(convert_measurements("dz_a_aazzaaa")) + print(convert_measurements("abbcc")) + print(convert_measurements("a")) + print(convert_measurements("aa")) + print(convert_measurements("a_")) + print(convert_measurements("abcdabcdab")) + print(convert_measurements("abcdabcdab_asas")) + print(convert_measurements("_")) + print(convert_measurements("_ad")) + print(convert_measurements("a_")) + print(convert_measurements("_______")) + print(convert_measurements("aaa")) From 2eb6d080d8951387a47ac254cc0ed876f5fabf0f Mon Sep 17 00:00:00 2001 From: abdulaziz ali hamed al badi <71528@omantel.om> Date: Wed, 1 May 2024 14:03:39 +0400 Subject: [PATCH 3/7] added changes --- ReadMe.txt | 66 +++-- controller/__init__.py | 0 controller/measurement_controller.py | 21 +- db_utils/__init__.py | 0 db_utils/db_crud_operations.py | 47 ++++ error_log.log | 239 ++++++++++++++++++ models/__init__.py | 0 models/processed_result.py | 4 + services/__init__.py | 0 services/test/__init__.py | 0 .../test/test_measurement_service.py | 2 +- 11 files changed, 358 insertions(+), 21 deletions(-) create mode 100644 controller/__init__.py create mode 100644 db_utils/__init__.py create mode 100644 db_utils/db_crud_operations.py create mode 100644 models/__init__.py create mode 100644 models/processed_result.py create mode 100644 services/__init__.py create mode 100644 services/test/__init__.py rename testing.py => services/test/test_measurement_service.py (95%) diff --git a/ReadMe.txt b/ReadMe.txt index 4d096ec..726ed38 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,16 +1,50 @@ - Run and Test the Application -Make sure you have the SQLite library and CherryPy installed, and then run the application. You can test it using curl or any similar tool: - -To convert and store an input: -bash -Copy code -curl "http://localhost:8080/convert?input_str=abc" -To retrieve the conversion history: -bash -Copy code -curl "http://localhost:8080/history" -Explanation of the Code -Modular Design: The conversion logic is separated into its own file (conversion_logic.py), keeping the conversion function isolated from the web server logic. -Database Operations: The application handles all database interactions such as connecting, creating tables, inserting records, and fetching history directly in main.py, interfacing with the database using SQLite. -CherryPy Setup: The application exposes two endpoints: one for converting strings and storing the results (convert) and another for retrieving the conversion history (history). -This setup maintains a clean separation between the conversion logic and the API/web server logic, making it easier to manage and extend each part of your application independently. \ No newline at end of file + +# Package Measurement Conversion + +## Overview +This application exposes a RESTful API endpoint that accepts a masurement input as string of characters, and returns a response of a list of total values of measured inflows. + +## Features +- **Package Measurement Conversion:** Accepts a sequence of characters and returns a result list of measured inflows. +- **Clear and adaptable:** Easily modified and extended to include additional functionalities. + +## Installation +- Clone the following url in your command prompt: https://github.com/aaziz9/PackageMeasurementConversionAPI.git + +### Prerequisites +- Python 3.x +- CherryPy + +### Setup +1. Clone the repository (see the Installation section above). +2. Install CherryPy package: + ```pip install CherryPy==18.9.0``` + +### Running the Program +- **Script**: + + Default: ```python main_app.py``` + + Specific port: ```python main_app.py ``` + +### Usage +- Call the API using the following URLs: + + "http://localhost:8080/convert?input_str= + + +- Get history of all conversions: + + Default: http://localhost:8080/history + +## Contributing +Contributions to this project are prohibited due to the course restrictions. + +## License +This project is licensed under the MIT License. + +## Contact +For any queries, please contact 71528@omantel.om + +## Acknowledgements +Project by Abdulaziz Ali Al Badi \ No newline at end of file diff --git a/controller/__init__.py b/controller/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/controller/measurement_controller.py b/controller/measurement_controller.py index b0dc452..ab72048 100644 --- a/controller/measurement_controller.py +++ b/controller/measurement_controller.py @@ -2,10 +2,12 @@ import sqlite3 from services.measurement_service import convert_measurements # Ensure this module and function are correctly implemented. import logging +from db_utils.db_crud_operations import DbCrudOpearations +from models.processed_result import ProcessResult -DATABASE_NAME = "measurements.db" +#DATABASE_NAME = "measurements.db" -class MeasurementAPI: +"""class MeasurementAPI: def __init__(self): self.create_table() @@ -30,6 +32,7 @@ def add_to_history(self, input_str, output_str): logging.error(f"Database error: {e}") # Optionally, re-raise or handle the error differently raise + def get_history(self): try: @@ -39,6 +42,10 @@ def get_history(self): except sqlite3.DatabaseError as e: logging.error(f"Database error: {e}") return [] +""" +class MeasurementAPI: + def __init__(self) -> None: + pass @cherrypy.expose @cherrypy.tools.json_out() @@ -46,11 +53,17 @@ def convert(self, input_str=""): if not input_str: return {"error": "No input provided"} result = convert_measurements(input_str) - self.add_to_history(input_str, str(result)) + # Create a new object and then pass it + # self.add_to_history(input_str, str(result)) + processed_result_obj=ProcessResult() + processed_result_obj.given_seq = input_str + processed_result_obj.generated_seq = str(result) + + self.add_to_history(processed_result_obj) return {"input": input_str, "output": result} @cherrypy.expose @cherrypy.tools.json_out() def history(self): - return {"history": self.get_history()} + return {"history": DbCrudOpearations().get_history()} \ No newline at end of file diff --git a/db_utils/__init__.py b/db_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/db_utils/db_crud_operations.py b/db_utils/db_crud_operations.py new file mode 100644 index 0000000..bbc1e8d --- /dev/null +++ b/db_utils/db_crud_operations.py @@ -0,0 +1,47 @@ +import sqlite3 +import logging +from services.measurement_service import convert_measurements # Ensure this module and function are correctly implemented. +from models.processed_result import ProcessResult + +import cherrypy + + +DATABASE_NAME = "measurements.db" + +class DbCrudOpearations: + + def __init__(self): + self.create_table() + + def connect(self): + return sqlite3.connect(DATABASE_NAME) + + def create_table(self): + + with self.connect() as conn: + cursor = conn.cursor() + cursor.execute(''' + CREATE TABLE IF NOT EXISTS history ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + input_str TEXT NOT NULL, + output_str TEXT NOT NULL + ); + ''') + + def add_to_history(self, processed_res_obj: ProcessResult): + try: + with self.connect() as conn: + conn.execute('INSERT INTO history (input_str, output_str) VALUES (?, ?)', (processed_res_obj.given_seq, processed_res_obj.generated_seq)) + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + # Optionally, re-raise or handle the error differently + raise + + def get_history(self): + try: + with self.connect() as conn: + cursor = conn.execute('SELECT input_str, output_str FROM history') + return [{"input": row[0], "output": row[1]} for row in cursor.fetchall()] + except sqlite3.DatabaseError as e: + logging.error(f"Database error: {e}") + return [] \ No newline at end of file diff --git a/error_log.log b/error_log.log index 72231d3..7b06235 100644 --- a/error_log.log +++ b/error_log.log @@ -228,3 +228,242 @@ cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0. 2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITING 2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITED 2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Waiting for child threads to terminate... +2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Listening for SIGTERM. +2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Bus STARTING +2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:50:03,530:INFO:[01/May/2024:11:50:03] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:50:03,531:INFO:[01/May/2024:11:50:03] ENGINE Bus STARTED +2024-05-01 11:50:08,550:INFO:127.0.0.1 - - [01/May/2024:11:50:08] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Bus STOPPING +2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus STOPPED +2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus EXITING +2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus EXITED +2024-05-01 11:51:32,981:INFO:[01/May/2024:11:51:32] ENGINE Waiting for child threads to terminate... +2024-05-01 11:51:32,981:INFO:[01/May/2024:11:51:32] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-01 11:51:46,471:INFO:[01/May/2024:11:51:46] ENGINE Listening for SIGTERM. +2024-05-01 11:51:46,471:INFO:[01/May/2024:11:51:46] ENGINE Bus STARTING +2024-05-01 11:51:46,474:INFO:[01/May/2024:11:51:46] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:51:46,681:INFO:[01/May/2024:11:51:46] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:51:46,681:INFO:[01/May/2024:11:51:46] ENGINE Bus STARTED +2024-05-01 11:51:51,993:ERROR:[01/May/2024:11:51:51] HTTP +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond + self._do_respond(path_info) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond + response.body = self.handler() + ^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ + self.body = self.oldhandler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler + value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ + return self.callable(*self.args, **self.kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 57, in history + return {"history": self.get_history()} + ^^^^^^^^^^^^^^^^ +AttributeError: 'MeasurementAPI' object has no attribute 'get_history' +2024-05-01 11:51:52,115:INFO:[01/May/2024:11:51:52] HTTP +Request Headers: + Remote-Addr: 127.0.0.1 + USER-AGENT: PostmanRuntime/7.37.3 + ACCEPT: */* + CACHE-CONTROL: no-cache + POSTMAN-TOKEN: 77dd2d1e-9704-4501-b1a5-f7e146207e55 + HOST: localhost:8080 + ACCEPT-ENCODING: gzip, deflate, br + CONNECTION: keep-alive +2024-05-01 11:51:52,120:INFO:127.0.0.1 - - [01/May/2024:11:51:52] "GET /history HTTP/1.1" 500 2189 "" "PostmanRuntime/7.37.3" +2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Bus STOPPING +2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus STOPPED +2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus EXITING +2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus EXITED +2024-05-01 11:54:22,123:INFO:[01/May/2024:11:54:22] ENGINE Waiting for child threads to terminate... +2024-05-01 11:54:22,123:INFO:[01/May/2024:11:54:22] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-01 11:54:22,578:INFO:[01/May/2024:11:54:22] ENGINE Listening for SIGTERM. +2024-05-01 11:54:22,578:INFO:[01/May/2024:11:54:22] ENGINE Bus STARTING +2024-05-01 11:54:22,585:INFO:[01/May/2024:11:54:22] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:54:22,797:INFO:[01/May/2024:11:54:22] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:54:22,797:INFO:[01/May/2024:11:54:22] ENGINE Bus STARTED +2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Listening for SIGTERM. +2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Bus STARTING +2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:56:32,325:ERROR:[01/May/2024:11:56:32] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-01 11:56:32,327:ERROR:[01/May/2024:11:56:32] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-01 11:56:32,327:INFO:[01/May/2024:11:56:32] ENGINE Bus STOPPING +2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus STOPPED +2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus EXITING +2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus EXITED +2024-05-01 11:56:57,378:INFO:[01/May/2024:11:56:57] ENGINE Listening for SIGTERM. +2024-05-01 11:56:57,378:INFO:[01/May/2024:11:56:57] ENGINE Bus STARTING +2024-05-01 11:56:57,384:INFO:[01/May/2024:11:56:57] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 11:56:57,608:INFO:[01/May/2024:11:56:57] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 11:56:57,608:INFO:[01/May/2024:11:56:57] ENGINE Bus STARTED +2024-05-01 11:57:11,420:ERROR:[01/May/2024:11:57:11] HTTP +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond + self._do_respond(path_info) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond + response.body = self.handler() + ^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ + self.body = self.oldhandler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler + value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ + return self.callable(*self.args, **self.kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 57, in history + return {"history": self.DbCrudOpearations.get_history()} + ^^^^^^^^^^^^^^^^^^^^^^ +AttributeError: 'MeasurementAPI' object has no attribute 'DbCrudOpearations' +2024-05-01 11:57:11,429:INFO:[01/May/2024:11:57:11] HTTP +Request Headers: + Remote-Addr: 127.0.0.1 + USER-AGENT: PostmanRuntime/7.37.3 + ACCEPT: */* + CACHE-CONTROL: no-cache + POSTMAN-TOKEN: 383b524c-555f-4e8f-acd0-3936c805d21a + HOST: localhost:8080 + ACCEPT-ENCODING: gzip, deflate, br + CONNECTION: keep-alive +2024-05-01 11:57:11,429:INFO:127.0.0.1 - - [01/May/2024:11:57:11] "GET /history HTTP/1.1" 500 2219 "" "PostmanRuntime/7.37.3" +2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Bus STOPPING +2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus STOPPED +2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus EXITING +2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus EXITED +2024-05-01 12:10:44,297:INFO:[01/May/2024:12:10:44] ENGINE Waiting for child threads to terminate... +2024-05-01 12:10:44,297:INFO:[01/May/2024:12:10:44] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-01 12:10:44,788:INFO:[01/May/2024:12:10:44] ENGINE Listening for SIGTERM. +2024-05-01 12:10:44,788:INFO:[01/May/2024:12:10:44] ENGINE Bus STARTING +2024-05-01 12:10:44,795:INFO:[01/May/2024:12:10:44] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 12:10:45,011:INFO:[01/May/2024:12:10:45] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 12:10:45,012:INFO:[01/May/2024:12:10:45] ENGINE Bus STARTED +2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\db_utils\db_crud_operations.py changed. +2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Bus STOPPING +2024-05-01 12:11:02,133:INFO:[01/May/2024:12:11:02] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus STOPPED +2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus EXITING +2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus EXITED +2024-05-01 12:11:02,205:INFO:[01/May/2024:12:11:02] ENGINE Waiting for child threads to terminate... +2024-05-01 12:11:02,205:INFO:[01/May/2024:12:11:02] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-01 12:11:02,714:INFO:[01/May/2024:12:11:02] ENGINE Listening for SIGTERM. +2024-05-01 12:11:02,715:INFO:[01/May/2024:12:11:02] ENGINE Bus STARTING +2024-05-01 12:11:02,716:INFO:[01/May/2024:12:11:02] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 12:11:02,959:INFO:[01/May/2024:12:11:02] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 12:11:02,959:INFO:[01/May/2024:12:11:02] ENGINE Bus STARTED +2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Listening for SIGTERM. +2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Bus STARTING +2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 12:11:11,709:ERROR:[01/May/2024:12:11:11] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-01 12:11:11,709:ERROR:[01/May/2024:12:11:11] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus STOPPING +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus STOPPED +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus EXITING +2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus EXITED +2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Listening for SIGTERM. +2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Bus STARTING +2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 12:11:26,109:INFO:[01/May/2024:12:11:26] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 12:11:26,111:INFO:[01/May/2024:12:11:26] ENGINE Bus STARTED +2024-05-01 12:11:33,011:INFO:127.0.0.1 - - [01/May/2024:12:11:33] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 12:55:40,618:INFO:[01/May/2024:12:55:40] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 12:55:40,618:INFO:[01/May/2024:12:55:40] ENGINE Bus STOPPING +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus STOPPED +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus EXITING +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus EXITED +2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Waiting for child threads to terminate... +2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Listening for SIGTERM. +2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Bus STARTING +2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Started monitor thread 'Autoreloader'. +2024-05-01 13:54:10,741:INFO:[01/May/2024:13:54:10] ENGINE Serving on http://0.0.0.0:8080 +2024-05-01 13:54:10,741:INFO:[01/May/2024:13:54:10] ENGINE Bus STARTED +2024-05-01 13:54:16,217:INFO:127.0.0.1 - - [01/May/2024:13:54:16] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" +2024-05-01 13:56:21,428:INFO:[01/May/2024:13:56:21] ENGINE Keyboard Interrupt: shutting down bus +2024-05-01 13:56:21,428:INFO:[01/May/2024:13:56:21] ENGINE Bus STOPPING +2024-05-01 13:56:21,633:INFO:[01/May/2024:13:56:21] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-01 13:56:21,634:INFO:[01/May/2024:13:56:21] ENGINE Stopped thread 'Autoreloader'. +2024-05-01 13:56:21,635:INFO:[01/May/2024:13:56:21] ENGINE Bus STOPPED +2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITING +2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITED +2024-05-01 13:56:21,637:INFO:[01/May/2024:13:56:21] ENGINE Waiting for child threads to terminate... diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/models/processed_result.py b/models/processed_result.py new file mode 100644 index 0000000..ce4e9dd --- /dev/null +++ b/models/processed_result.py @@ -0,0 +1,4 @@ +class ProcessResult: + def __init__(self) -> None: + self.given_seq: str = "" + self.generated_seq: list[int] = [] \ No newline at end of file diff --git a/services/__init__.py b/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/test/__init__.py b/services/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testing.py b/services/test/test_measurement_service.py similarity index 95% rename from testing.py rename to services/test/test_measurement_service.py index c66d1f1..a510441 100644 --- a/testing.py +++ b/services/test/test_measurement_service.py @@ -1,5 +1,5 @@ import unittest -from logic import convert_measurements +from services.measurement_service import convert_measurements class TestConvertMeasurements(unittest.TestCase): """ From 2d3e2ef1c65bf739beb73747266b52ec19b4c086 Mon Sep 17 00:00:00 2001 From: abdulaziz ali hamed al badi <71528@omantel.om> Date: Thu, 2 May 2024 09:38:46 +0400 Subject: [PATCH 4/7] added changes --- controller/measurement_controller.py | 47 +-- error_log.log | 450 +++++++++++++++++++++++++++ measurements.db | Bin 12288 -> 12288 bytes 3 files changed, 456 insertions(+), 41 deletions(-) diff --git a/controller/measurement_controller.py b/controller/measurement_controller.py index ab72048..11815e6 100644 --- a/controller/measurement_controller.py +++ b/controller/measurement_controller.py @@ -7,51 +7,15 @@ #DATABASE_NAME = "measurements.db" -"""class MeasurementAPI: - def __init__(self): - self.create_table() - - def connect(self): - return sqlite3.connect(DATABASE_NAME) - - def create_table(self): - with self.connect() as conn: - conn.execute(''' - CREATE TABLE IF NOT EXISTS history ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - input_str TEXT NOT NULL, - output_str TEXT NOT NULL - ); - ''') - - def add_to_history(self, input_str, output_str): - try: - with self.connect() as conn: - conn.execute('INSERT INTO history (input_str, output_str) VALUES (?, ?)', (input_str, output_str)) - except sqlite3.DatabaseError as e: - logging.error(f"Database error: {e}") - # Optionally, re-raise or handle the error differently - raise - - - def get_history(self): - try: - with self.connect() as conn: - cursor = conn.execute('SELECT input_str, output_str FROM history') - return [{"input": row[0], "output": row[1]} for row in cursor.fetchall()] - except sqlite3.DatabaseError as e: - logging.error(f"Database error: {e}") - return [] -""" class MeasurementAPI: def __init__(self) -> None: - pass + self.storing_history = DbCrudOpearations() @cherrypy.expose @cherrypy.tools.json_out() def convert(self, input_str=""): if not input_str: - return {"error": "No input provided"} + return {"status": "fail", "err_msg": "invalid sequence", "result": []} result = convert_measurements(input_str) # Create a new object and then pass it # self.add_to_history(input_str, str(result)) @@ -59,11 +23,12 @@ def convert(self, input_str=""): processed_result_obj.given_seq = input_str processed_result_obj.generated_seq = str(result) - self.add_to_history(processed_result_obj) - return {"input": input_str, "output": result} + self.storing_history.add_to_history(processed_result_obj) + return {"status": "success", "err_msg": "", "result": [processed_result_obj.generated_seq]} + #return {"input": processed_result_obj.given_seq, "output": processed_result_obj.generated_seq} @cherrypy.expose @cherrypy.tools.json_out() def history(self): - return {"history": DbCrudOpearations().get_history()} + return {"history": self.storing_history.get_history()} \ No newline at end of file diff --git a/error_log.log b/error_log.log index 7b06235..8a11a71 100644 --- a/error_log.log +++ b/error_log.log @@ -467,3 +467,453 @@ cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0. 2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITING 2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITED 2024-05-01 13:56:21,637:INFO:[01/May/2024:13:56:21] ENGINE Waiting for child threads to terminate... +2024-05-02 09:07:07,026:INFO:[02/May/2024:09:07:07] ENGINE Listening for SIGTERM. +2024-05-02 09:07:07,026:INFO:[02/May/2024:09:07:07] ENGINE Bus STARTING +2024-05-02 09:07:07,028:INFO:[02/May/2024:09:07:07] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:07:07,262:INFO:[02/May/2024:09:07:07] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:07:07,262:INFO:[02/May/2024:09:07:07] ENGINE Bus STARTED +2024-05-02 09:07:25,101:ERROR:[02/May/2024:09:07:25] HTTP +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond + self._do_respond(path_info) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond + response.body = self.handler() + ^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ + self.body = self.oldhandler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler + value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ + return self.callable(*self.args, **self.kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 62, in convert + self.add_to_history(processed_result_obj) + ^^^^^^^^^^^^^^^^^^^ +AttributeError: 'MeasurementAPI' object has no attribute 'add_to_history' +2024-05-02 09:07:25,190:INFO:[02/May/2024:09:07:25] HTTP +Request Headers: + Remote-Addr: 127.0.0.1 + HOST: localhost:8080 + CONNECTION: keep-alive + SEC-CH-UA: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" + SEC-CH-UA-MOBILE: ?0 + SEC-CH-UA-PLATFORM: "Windows" + UPGRADE-INSECURE-REQUESTS: 1 + USER-AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 + ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 + SEC-FETCH-SITE: none + SEC-FETCH-MODE: navigate + SEC-FETCH-USER: ?1 + SEC-FETCH-DEST: document + ACCEPT-ENCODING: gzip, deflate, br, zstd + ACCEPT-LANGUAGE: en-US,en;q=0.9,ar;q=0.8 +2024-05-02 09:07:25,198:INFO:127.0.0.1 - - [02/May/2024:09:07:25] "GET /convert?input_str=ab HTTP/1.1" 500 2179 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:09:54,943:INFO:[02/May/2024:09:09:54] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:09:54,944:INFO:[02/May/2024:09:09:54] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:09:54,944:INFO:[02/May/2024:09:09:54] ENGINE Bus STOPPING +2024-05-02 09:09:55,124:INFO:[02/May/2024:09:09:55] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:09:55,124:INFO:[02/May/2024:09:09:55] ENGINE Bus STOPPED +2024-05-02 09:09:55,126:INFO:[02/May/2024:09:09:55] ENGINE Bus EXITING +2024-05-02 09:09:55,126:INFO:[02/May/2024:09:09:55] ENGINE Bus EXITED +2024-05-02 09:09:55,212:INFO:[02/May/2024:09:09:55] ENGINE Waiting for child threads to terminate... +2024-05-02 09:09:55,225:INFO:[02/May/2024:09:09:55] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Listening for SIGTERM. +2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Bus STARTING +2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:09:56,413:INFO:[02/May/2024:09:09:56] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:09:56,413:INFO:[02/May/2024:09:09:56] ENGINE Bus STARTED +2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Bus STOPPING +2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE Bus STOPPED +2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE Bus EXITING +2024-05-02 09:13:42,013:INFO:[02/May/2024:09:13:42] ENGINE Bus EXITED +2024-05-02 09:13:42,050:INFO:[02/May/2024:09:13:42] ENGINE Waiting for child threads to terminate... +2024-05-02 09:13:42,052:INFO:[02/May/2024:09:13:42] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Listening for SIGTERM. +2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Bus STARTING +2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:13:42,743:INFO:[02/May/2024:09:13:42] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:13:42,743:INFO:[02/May/2024:09:13:42] ENGINE Bus STARTED +2024-05-02 09:13:53,021:INFO:127.0.0.1 - - [02/May/2024:09:13:53] "GET /convert?input_str=ab HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:14:00,854:INFO:127.0.0.1 - - [02/May/2024:09:14:00] "GET /convert?input_str=aa HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:14:13,026:INFO:127.0.0.1 - - [02/May/2024:09:14:13] "GET /convert?input_str=aaa HTTP/1.1" 200 34 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:14:24,455:INFO:127.0.0.1 - - [02/May/2024:09:14:24] "GET /convert?input_str=aa HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:14:50,218:INFO:127.0.0.1 - - [02/May/2024:09:14:50] "GET /history HTTP/1.1" 200 292 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +2024-05-02 09:22:02,372:INFO:[02/May/2024:09:22:02] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:22:02,379:INFO:[02/May/2024:09:22:02] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:22:02,379:INFO:[02/May/2024:09:22:02] ENGINE Bus STOPPING +2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus STOPPED +2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus EXITING +2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus EXITED +2024-05-02 09:22:02,580:INFO:[02/May/2024:09:22:02] ENGINE Waiting for child threads to terminate... +2024-05-02 09:22:02,580:INFO:[02/May/2024:09:22:02] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Listening for SIGTERM. +2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Bus STARTING +2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:22:03,291:INFO:[02/May/2024:09:22:03] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:22:03,291:INFO:[02/May/2024:09:22:03] ENGINE Bus STARTED +2024-05-02 09:22:08,270:INFO:127.0.0.1 - - [02/May/2024:09:22:08] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" +2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Bus STOPPING +2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus STOPPED +2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus EXITING +2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus EXITED +2024-05-02 09:25:57,841:INFO:[02/May/2024:09:25:57] ENGINE Waiting for child threads to terminate... +2024-05-02 09:25:57,841:INFO:[02/May/2024:09:25:57] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:25:58,626:INFO:[02/May/2024:09:25:58] ENGINE Listening for SIGTERM. +2024-05-02 09:25:58,626:INFO:[02/May/2024:09:25:58] ENGINE Bus STARTING +2024-05-02 09:25:58,642:INFO:[02/May/2024:09:25:58] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:25:58,856:INFO:[02/May/2024:09:25:58] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:25:58,856:INFO:[02/May/2024:09:25:58] ENGINE Bus STARTED +2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Bus STOPPING +2024-05-02 09:26:50,548:INFO:[02/May/2024:09:26:50] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:26:50,549:INFO:[02/May/2024:09:26:50] ENGINE Bus STOPPED +2024-05-02 09:26:50,550:INFO:[02/May/2024:09:26:50] ENGINE Bus EXITING +2024-05-02 09:26:50,550:INFO:[02/May/2024:09:26:50] ENGINE Bus EXITED +2024-05-02 09:26:50,557:INFO:[02/May/2024:09:26:50] ENGINE Waiting for child threads to terminate... +2024-05-02 09:26:50,557:INFO:[02/May/2024:09:26:50] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Listening for SIGTERM. +2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Bus STARTING +2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:26:51,300:INFO:[02/May/2024:09:26:51] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:26:51,302:INFO:[02/May/2024:09:26:51] ENGINE Bus STARTED +2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Bus STOPPING +2024-05-02 09:26:54,258:INFO:[02/May/2024:09:26:54] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:26:54,259:INFO:[02/May/2024:09:26:54] ENGINE Bus STOPPED +2024-05-02 09:26:54,261:INFO:[02/May/2024:09:26:54] ENGINE Bus EXITING +2024-05-02 09:26:54,261:INFO:[02/May/2024:09:26:54] ENGINE Bus EXITED +2024-05-02 09:26:54,318:INFO:[02/May/2024:09:26:54] ENGINE Waiting for child threads to terminate... +2024-05-02 09:26:54,318:INFO:[02/May/2024:09:26:54] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:26:54,775:INFO:[02/May/2024:09:26:54] ENGINE Listening for SIGTERM. +2024-05-02 09:26:54,775:INFO:[02/May/2024:09:26:54] ENGINE Bus STARTING +2024-05-02 09:26:54,781:INFO:[02/May/2024:09:26:54] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:26:55,000:INFO:[02/May/2024:09:26:55] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:26:55,001:INFO:[02/May/2024:09:26:55] ENGINE Bus STARTED +2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Bus STOPPING +2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus STOPPED +2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus EXITING +2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus EXITED +2024-05-02 09:27:21,344:INFO:[02/May/2024:09:27:21] ENGINE Waiting for child threads to terminate... +2024-05-02 09:27:21,345:INFO:[02/May/2024:09:27:21] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Listening for SIGTERM. +2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Bus STARTING +2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:27:22,004:INFO:[02/May/2024:09:27:22] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:27:22,004:INFO:[02/May/2024:09:27:22] ENGINE Bus STARTED +2024-05-02 09:27:26,171:ERROR:[02/May/2024:09:27:26] HTTP +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond + self._do_respond(path_info) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond + response.body = self.handler() + ^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ + self.body = self.oldhandler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler + value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ + return self.callable(*self.args, **self.kwargs) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 32, in history + return {"history": self.get_history()} + ^^^^^^^^^^^^^^^^ +AttributeError: 'MeasurementAPI' object has no attribute 'get_history' +2024-05-02 09:27:26,220:INFO:[02/May/2024:09:27:26] HTTP +Request Headers: + Remote-Addr: 127.0.0.1 + USER-AGENT: PostmanRuntime/7.37.3 + ACCEPT: */* + CACHE-CONTROL: no-cache + POSTMAN-TOKEN: c84243c6-8a83-4d81-be55-25d1256c4b00 + HOST: localhost:8080 + ACCEPT-ENCODING: gzip, deflate, br + CONNECTION: keep-alive + Content-Length: 0 +2024-05-02 09:27:26,226:INFO:127.0.0.1 - - [02/May/2024:09:27:26] "POST /history HTTP/1.1" 500 2189 "" "PostmanRuntime/7.37.3" +2024-05-02 09:27:57,330:INFO:[02/May/2024:09:27:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:27:57,330:INFO:[02/May/2024:09:27:57] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:27:57,331:INFO:[02/May/2024:09:27:57] ENGINE Bus STOPPING +2024-05-02 09:27:57,529:INFO:[02/May/2024:09:27:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus STOPPED +2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus EXITING +2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus EXITED +2024-05-02 09:27:57,603:INFO:[02/May/2024:09:27:57] ENGINE Waiting for child threads to terminate... +2024-05-02 09:27:57,603:INFO:[02/May/2024:09:27:57] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Listening for SIGTERM. +2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Bus STARTING +2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:27:58,306:INFO:[02/May/2024:09:27:58] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:27:58,308:INFO:[02/May/2024:09:27:58] ENGINE Bus STARTED +2024-05-02 09:28:01,747:INFO:127.0.0.1 - - [02/May/2024:09:28:01] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" +2024-05-02 09:29:12,293:INFO:[02/May/2024:09:29:12] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:29:12,294:INFO:[02/May/2024:09:29:12] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:29:12,294:INFO:[02/May/2024:09:29:12] ENGINE Bus STOPPING +2024-05-02 09:29:12,425:INFO:[02/May/2024:09:29:12] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:29:12,425:INFO:[02/May/2024:09:29:12] ENGINE Bus STOPPED +2024-05-02 09:29:12,426:INFO:[02/May/2024:09:29:12] ENGINE Bus EXITING +2024-05-02 09:29:12,426:INFO:[02/May/2024:09:29:12] ENGINE Bus EXITED +2024-05-02 09:29:12,455:INFO:[02/May/2024:09:29:12] ENGINE Waiting for child threads to terminate... +2024-05-02 09:29:12,455:INFO:[02/May/2024:09:29:12] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:29:13,010:INFO:[02/May/2024:09:29:13] ENGINE Listening for SIGTERM. +2024-05-02 09:29:13,016:INFO:[02/May/2024:09:29:13] ENGINE Bus STARTING +2024-05-02 09:29:13,016:INFO:[02/May/2024:09:29:13] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:29:13,252:INFO:[02/May/2024:09:29:13] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:29:13,252:INFO:[02/May/2024:09:29:13] ENGINE Bus STARTED +2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Bus STOPPING +2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus STOPPED +2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus EXITING +2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus EXITED +2024-05-02 09:31:25,100:INFO:[02/May/2024:09:31:25] ENGINE Waiting for child threads to terminate... +2024-05-02 09:31:25,100:INFO:[02/May/2024:09:31:25] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Listening for SIGTERM. +2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Bus STARTING +2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:31:25,723:INFO:[02/May/2024:09:31:25] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:31:25,724:INFO:[02/May/2024:09:31:25] ENGINE Bus STARTED +2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Listening for SIGTERM. +2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Bus STARTING +2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:31:51,336:ERROR:[02/May/2024:09:31:51] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-02 09:31:51,341:ERROR:[02/May/2024:09:31:51] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Bus STOPPING +2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Bus STOPPED +2024-05-02 09:31:51,344:INFO:[02/May/2024:09:31:51] ENGINE Bus EXITING +2024-05-02 09:31:51,344:INFO:[02/May/2024:09:31:51] ENGINE Bus EXITED +2024-05-02 09:32:05,402:INFO:[02/May/2024:09:32:05] ENGINE Listening for SIGTERM. +2024-05-02 09:32:05,402:INFO:[02/May/2024:09:32:05] ENGINE Bus STARTING +2024-05-02 09:32:05,418:INFO:[02/May/2024:09:32:05] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:32:06,506:ERROR:[02/May/2024:09:32:06] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-02 09:32:06,518:ERROR:[02/May/2024:09:32:06] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-02 09:32:06,520:INFO:[02/May/2024:09:32:06] ENGINE Bus STOPPING +2024-05-02 09:32:06,522:INFO:[02/May/2024:09:32:06] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus STOPPED +2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus EXITING +2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus EXITED +2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Listening for SIGTERM. +2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Bus STARTING +2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:32:20,332:INFO:[02/May/2024:09:32:20] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:32:20,332:INFO:[02/May/2024:09:32:20] ENGINE Bus STARTED +2024-05-02 09:32:27,460:INFO:127.0.0.1 - - [02/May/2024:09:32:27] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" +2024-05-02 09:33:03,653:INFO:127.0.0.1 - - [02/May/2024:09:33:03] "POST /convert?input_str=bbf HTTP/1.1" 200 33 "" "PostmanRuntime/7.37.3" +2024-05-02 09:33:14,251:INFO:127.0.0.1 - - [02/May/2024:09:33:14] "POST /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" +2024-05-02 09:33:18,786:INFO:127.0.0.1 - - [02/May/2024:09:33:18] "GET /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" +2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. +2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Bus STOPPING +2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down +2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus STOPPED +2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus EXITING +2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus EXITED +2024-05-02 09:35:58,082:INFO:[02/May/2024:09:35:58] ENGINE Waiting for child threads to terminate... +2024-05-02 09:35:58,082:INFO:[02/May/2024:09:35:58] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py +2024-05-02 09:35:58,553:INFO:[02/May/2024:09:35:58] ENGINE Listening for SIGTERM. +2024-05-02 09:35:58,553:INFO:[02/May/2024:09:35:58] ENGINE Bus STARTING +2024-05-02 09:35:58,559:INFO:[02/May/2024:09:35:58] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:35:58,767:INFO:[02/May/2024:09:35:58] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:35:58,768:INFO:[02/May/2024:09:35:58] ENGINE Bus STARTED +2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Listening for SIGTERM. +2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Bus STARTING +2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:36:16,073:ERROR:[02/May/2024:09:36:16] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-02 09:36:16,073:ERROR:[02/May/2024:09:36:16] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus STOPPING +2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus STOPPED +2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus EXITING +2024-05-02 09:36:16,085:INFO:[02/May/2024:09:36:16] ENGINE Bus EXITED +2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Listening for SIGTERM. +2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Bus STARTING +2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:36:26,747:ERROR:[02/May/2024:09:36:26] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-02 09:36:26,750:ERROR:[02/May/2024:09:36:26] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus STOPPING +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus STOPPED +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus EXITING +2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus EXITED +2024-05-02 09:36:32,264:INFO:[02/May/2024:09:36:32] ENGINE Listening for SIGTERM. +2024-05-02 09:36:32,264:INFO:[02/May/2024:09:36:32] ENGINE Bus STARTING +2024-05-02 09:36:32,277:INFO:[02/May/2024:09:36:32] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:36:33,369:ERROR:[02/May/2024:09:36:33] ENGINE Error in 'start' listener > +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free + Checker(timeout=0.1).assert_free(host, port) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free + list(itertools.starmap(self._connect, info)) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect + raise PortNotFree(tmpl.format(**locals())) +portend.PortNotFree: Port 8080 is in use on 127.0.0.1. + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish + output.append(listener(*args, **kwargs)) + ^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start + super(Server, self).start() + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start + portend.free(*self.bind_addr, timeout=Timeouts.free) + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free + raise Timeout("Port {port} not free on {host}.".format(**locals())) +portend.Timeout: Port 8080 not free on 0.0.0.0. + +2024-05-02 09:36:33,369:ERROR:[02/May/2024:09:36:33] ENGINE Shutting down due to error in start listener: +Traceback (most recent call last): + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start + self.publish('start') + File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish + raise exc +cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') + +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus STOPPING +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Stopped thread 'Autoreloader'. +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus STOPPED +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITING +2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITED diff --git a/measurements.db b/measurements.db index a12d292e77129ffb7df4745bdb0f9453d1cf6bf6..b9b9ad31498ecdbdee09203cce011c0b69b8d35a 100644 GIT binary patch delta 128 zcmZojXh@hK&B#4b#+i|OW5N=C2`>H)2L3PnFZu8CU*tc=zngyz|3dz${2iMG1#_A~jkP<^31%p^lHn Date: Thu, 2 May 2024 09:41:21 +0400 Subject: [PATCH 5/7] added error_log --- error_log.log | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/error_log.log b/error_log.log index 8a11a71..14a8cef 100644 --- a/error_log.log +++ b/error_log.log @@ -917,3 +917,10 @@ cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0. 2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus STOPPED 2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITING 2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITED +2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Listening for SIGTERM. +2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Bus STARTING +2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Started monitor thread 'Autoreloader'. +2024-05-02 09:36:51,727:INFO:[02/May/2024:09:36:51] ENGINE Serving on http://0.0.0.0:8080 +2024-05-02 09:36:51,728:INFO:[02/May/2024:09:36:51] ENGINE Bus STARTED +2024-05-02 09:37:02,652:INFO:127.0.0.1 - - [02/May/2024:09:37:02] "GET /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" +2024-05-02 09:37:38,231:INFO:127.0.0.1 - - [02/May/2024:09:37:38] "GET /convert?input_str=caaa HTTP/1.1" 200 55 "" "PostmanRuntime/7.37.3" From 8493314be9991d06da68a98c083b2ba0e12c62a9 Mon Sep 17 00:00:00 2001 From: abdulaziz ali hamed al badi <71528@omantel.om> Date: Thu, 2 May 2024 09:44:31 +0400 Subject: [PATCH 6/7] modified readme --- ReadMe.txt => ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ReadMe.txt => ReadMe.md (96%) diff --git a/ReadMe.txt b/ReadMe.md similarity index 96% rename from ReadMe.txt rename to ReadMe.md index 726ed38..be5d152 100644 --- a/ReadMe.txt +++ b/ReadMe.md @@ -44,7 +44,7 @@ Contributions to this project are prohibited due to the course restrictions. This project is licensed under the MIT License. ## Contact -For any queries, please contact 71528@omantel.om +For any queries, please contact aaziz9 @ github ## Acknowledgements Project by Abdulaziz Ali Al Badi \ No newline at end of file From af08544774dce326c72efa2d69e97d8fda9c4857 Mon Sep 17 00:00:00 2001 From: abdulaziz ali hamed al badi <71528@omantel.om> Date: Thu, 2 May 2024 10:04:36 +0400 Subject: [PATCH 7/7] modified result format --- .gitignore | 2 + controller/measurement_controller.py | 3 +- error_log.log | 926 --------------------------- measurements.db | Bin 12288 -> 0 bytes 4 files changed, 4 insertions(+), 927 deletions(-) delete mode 100644 error_log.log delete mode 100644 measurements.db diff --git a/.gitignore b/.gitignore index d63adf3..b09dd39 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ +*.log +*.db **/__pycache__ diff --git a/controller/measurement_controller.py b/controller/measurement_controller.py index 11815e6..dcdc930 100644 --- a/controller/measurement_controller.py +++ b/controller/measurement_controller.py @@ -4,6 +4,7 @@ import logging from db_utils.db_crud_operations import DbCrudOpearations from models.processed_result import ProcessResult +import ast #DATABASE_NAME = "measurements.db" @@ -24,7 +25,7 @@ def convert(self, input_str=""): processed_result_obj.generated_seq = str(result) self.storing_history.add_to_history(processed_result_obj) - return {"status": "success", "err_msg": "", "result": [processed_result_obj.generated_seq]} + return {"status": "success", "err_msg": "", "result": ast.literal_eval(processed_result_obj.generated_seq)} #To convert a string representation of a list into an actual list in Python, you can use the ast.literal_eval() function from the ast module. this is done for easier testing as tester wants it in a certain format #return {"input": processed_result_obj.given_seq, "output": processed_result_obj.generated_seq} @cherrypy.expose diff --git a/error_log.log b/error_log.log deleted file mode 100644 index 14a8cef..0000000 --- a/error_log.log +++ /dev/null @@ -1,926 +0,0 @@ -2024-05-01 08:37:39,743:INFO:[01/May/2024:08:37:39] ENGINE Listening for SIGTERM. -2024-05-01 08:37:39,743:INFO:[01/May/2024:08:37:39] ENGINE Bus STARTING -2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Listening for SIGTERM. -2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Bus STARTING -2024-05-01 08:37:39,747:INFO:[01/May/2024:08:37:39] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 08:37:39,985:INFO:[01/May/2024:08:37:39] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 08:37:40,015:INFO:[01/May/2024:08:37:40] ENGINE Bus STARTED -2024-05-01 08:37:40,019:ERROR:[01/May/2024:08:37:40] ENGINE Error in HTTP server: shutting down -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 225, in _start_http_thread - self.httpserver.start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cheroot\server.py", line 1840, in start - self.prepare() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cheroot\server.py", line 1795, in prepare - raise socket.error(msg) -OSError: No socket could be created -- (('0.0.0.0', 8080): [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) - -2024-05-01 08:37:40,024:INFO:[01/May/2024:08:37:40] ENGINE Bus STOPPING -2024-05-01 08:37:40,025:INFO:[01/May/2024:08:37:40] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-01 08:37:40,027:INFO:[01/May/2024:08:37:40] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 08:37:40,028:INFO:[01/May/2024:08:37:40] ENGINE Bus STOPPED -2024-05-01 08:37:40,029:INFO:[01/May/2024:08:37:40] ENGINE Bus EXITING -2024-05-01 08:37:40,029:INFO:[01/May/2024:08:37:40] ENGINE Bus EXITED -2024-05-01 08:37:47,835:INFO:[01/May/2024:08:37:47] ENGINE Listening for SIGTERM. -2024-05-01 08:37:47,835:INFO:[01/May/2024:08:37:47] ENGINE Bus STARTING -2024-05-01 08:37:47,842:INFO:[01/May/2024:08:37:47] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 08:37:49,057:ERROR:[01/May/2024:08:37:49] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-01 08:37:49,057:ERROR:[01/May/2024:08:37:49] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE Bus STOPPING -2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-01 08:37:49,057:INFO:[01/May/2024:08:37:49] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 08:37:49,066:INFO:[01/May/2024:08:37:49] ENGINE Bus STOPPED -2024-05-01 08:37:49,066:INFO:[01/May/2024:08:37:49] ENGINE Bus EXITING -2024-05-01 08:37:49,067:INFO:[01/May/2024:08:37:49] ENGINE Bus EXITED -2024-05-01 08:38:10,145:INFO:[01/May/2024:08:38:10] ENGINE Listening for SIGTERM. -2024-05-01 08:38:10,145:INFO:[01/May/2024:08:38:10] ENGINE Bus STARTING -2024-05-01 08:38:10,159:INFO:[01/May/2024:08:38:10] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 08:38:11,199:ERROR:[01/May/2024:08:38:11] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-01 08:38:11,202:ERROR:[01/May/2024:08:38:11] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE Bus STOPPING -2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-01 08:38:11,204:INFO:[01/May/2024:08:38:11] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus STOPPED -2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus EXITING -2024-05-01 08:38:11,205:INFO:[01/May/2024:08:38:11] ENGINE Bus EXITED -2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\api.py changed. -2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 08:38:24,374:INFO:[01/May/2024:08:38:24] ENGINE Bus STOPPING -2024-05-01 08:38:24,512:INFO:[01/May/2024:08:38:24] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 08:38:24,512:INFO:[01/May/2024:08:38:24] ENGINE Bus STOPPED -2024-05-01 08:38:24,513:INFO:[01/May/2024:08:38:24] ENGINE Bus EXITING -2024-05-01 08:38:24,513:INFO:[01/May/2024:08:38:24] ENGINE Bus EXITED -2024-05-01 08:38:24,603:INFO:[01/May/2024:08:38:24] ENGINE Waiting for child threads to terminate... -2024-05-01 08:38:24,603:INFO:[01/May/2024:08:38:24] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/api.py -2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Listening for SIGTERM. -2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Bus STARTING -2024-05-01 08:55:43,077:INFO:[01/May/2024:08:55:43] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 08:55:43,292:INFO:[01/May/2024:08:55:43] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 08:55:43,292:INFO:[01/May/2024:08:55:43] ENGINE Bus STARTED -2024-05-01 08:55:50,245:INFO:127.0.0.1 - - [01/May/2024:08:55:50] "GET / HTTP/1.1" 404 1518 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 08:55:53,875:INFO:127.0.0.1 - - [01/May/2024:08:55:53] "GET / HTTP/1.1" 404 1518 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 08:56:13,884:INFO:127.0.0.1 - - [01/May/2024:08:56:13] "GET /convert?input_str=ab HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 08:57:13,264:INFO:127.0.0.1 - - [01/May/2024:08:57:13] "GET /history HTTP/1.1" 200 82 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 09:22:25,922:INFO:[01/May/2024:09:22:25] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 09:22:25,923:INFO:[01/May/2024:09:22:25] ENGINE Bus STOPPING -2024-05-01 09:22:26,063:INFO:[01/May/2024:09:22:26] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 09:22:26,063:INFO:[01/May/2024:09:22:26] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 09:22:26,064:INFO:[01/May/2024:09:22:26] ENGINE Bus STOPPED -2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Bus EXITING -2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Bus EXITED -2024-05-01 09:22:26,065:INFO:[01/May/2024:09:22:26] ENGINE Waiting for child threads to terminate... -2024-05-01 09:22:34,672:INFO:[01/May/2024:09:22:34] ENGINE Listening for SIGTERM. -2024-05-01 09:22:34,672:INFO:[01/May/2024:09:22:34] ENGINE Bus STARTING -2024-05-01 09:22:34,673:INFO:[01/May/2024:09:22:34] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 09:22:34,887:INFO:[01/May/2024:09:22:34] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 09:22:34,887:INFO:[01/May/2024:09:22:34] ENGINE Bus STARTED -2024-05-01 09:23:11,857:INFO:[01/May/2024:09:23:11] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 09:23:11,857:INFO:[01/May/2024:09:23:11] ENGINE Bus STOPPING -2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 09:23:12,001:INFO:[01/May/2024:09:23:12] ENGINE Bus STOPPED -2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Bus EXITING -2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Bus EXITED -2024-05-01 09:23:12,002:INFO:[01/May/2024:09:23:12] ENGINE Waiting for child threads to terminate... -2024-05-01 09:34:23,896:INFO:[01/May/2024:09:34:23] ENGINE Listening for SIGTERM. -2024-05-01 09:34:23,896:INFO:[01/May/2024:09:34:23] ENGINE Bus STARTING -2024-05-01 09:34:23,904:INFO:[01/May/2024:09:34:23] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 09:34:24,132:INFO:[01/May/2024:09:34:24] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 09:34:24,132:INFO:[01/May/2024:09:34:24] ENGINE Bus STARTED -2024-05-01 09:34:36,758:INFO:127.0.0.1 - - [01/May/2024:09:34:36] "GET /history HTTP/1.1" 200 82 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 09:35:07,609:INFO:127.0.0.1 - - [01/May/2024:09:35:07] "GET /convert?input_str=baa HTTP/1.1" 200 31 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 09:35:36,876:INFO:[01/May/2024:09:35:36] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 09:35:36,876:INFO:[01/May/2024:09:35:36] ENGINE Bus STOPPING -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus STOPPED -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus EXITING -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Bus EXITED -2024-05-01 09:35:37,048:INFO:[01/May/2024:09:35:37] ENGINE Waiting for child threads to terminate... -2024-05-01 10:45:20,667:INFO:[01/May/2024:10:45:20] ENGINE Listening for SIGTERM. -2024-05-01 10:45:20,667:INFO:[01/May/2024:10:45:20] ENGINE Bus STARTING -2024-05-01 10:45:20,676:INFO:[01/May/2024:10:45:20] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 10:45:20,895:INFO:[01/May/2024:10:45:20] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 10:45:20,895:INFO:[01/May/2024:10:45:20] ENGINE Bus STARTED -2024-05-01 10:45:32,076:INFO:127.0.0.1 - - [01/May/2024:10:45:32] "GET /convert?input_str=baa HTTP/1.1" 200 31 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-01 10:45:40,238:INFO:[01/May/2024:10:45:40] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 10:45:40,238:INFO:[01/May/2024:10:45:40] ENGINE Bus STOPPING -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus STOPPED -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITING -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Bus EXITED -2024-05-01 10:45:42,415:INFO:[01/May/2024:10:45:42] ENGINE Waiting for child threads to terminate... -2024-05-01 10:55:58,090:INFO:[01/May/2024:10:55:58] ENGINE Listening for SIGTERM. -2024-05-01 10:55:58,090:INFO:[01/May/2024:10:55:58] ENGINE Bus STARTING -2024-05-01 10:55:58,096:INFO:[01/May/2024:10:55:58] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 10:55:58,305:INFO:[01/May/2024:10:55:58] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 10:55:58,305:INFO:[01/May/2024:10:55:58] ENGINE Bus STARTED -2024-05-01 10:56:07,675:INFO:127.0.0.1 - - [01/May/2024:10:56:07] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 10:56:14,383:INFO:[01/May/2024:10:56:14] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 10:56:14,383:INFO:[01/May/2024:10:56:14] ENGINE Bus STOPPING -2024-05-01 10:56:14,515:INFO:[01/May/2024:10:56:14] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus STOPPED -2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus EXITING -2024-05-01 10:56:14,516:INFO:[01/May/2024:10:56:14] ENGINE Bus EXITED -2024-05-01 10:56:14,520:INFO:[01/May/2024:10:56:14] ENGINE Waiting for child threads to terminate... -2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Listening for SIGTERM. -2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Bus STARTING -2024-05-01 10:58:07,487:INFO:[01/May/2024:10:58:07] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 10:58:07,698:INFO:[01/May/2024:10:58:07] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 10:58:07,698:INFO:[01/May/2024:10:58:07] ENGINE Bus STARTED -2024-05-01 10:58:17,296:INFO:127.0.0.1 - - [01/May/2024:10:58:17] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 10:58:33,721:INFO:[01/May/2024:10:58:33] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 10:58:33,721:INFO:[01/May/2024:10:58:33] ENGINE Bus STOPPING -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus STOPPED -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus EXITING -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Bus EXITED -2024-05-01 10:58:33,890:INFO:[01/May/2024:10:58:33] ENGINE Waiting for child threads to terminate... -2024-05-01 11:01:49,983:INFO:[01/May/2024:11:01:49] ENGINE Listening for SIGTERM. -2024-05-01 11:01:49,983:INFO:[01/May/2024:11:01:49] ENGINE Bus STARTING -2024-05-01 11:01:49,987:INFO:[01/May/2024:11:01:49] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:01:50,207:INFO:[01/May/2024:11:01:50] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:01:50,207:INFO:[01/May/2024:11:01:50] ENGINE Bus STARTED -2024-05-01 11:02:11,639:INFO:127.0.0.1 - - [01/May/2024:11:02:11] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 11:02:19,129:INFO:[01/May/2024:11:02:19] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 11:02:19,129:INFO:[01/May/2024:11:02:19] ENGINE Bus STOPPING -2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 11:02:19,265:INFO:[01/May/2024:11:02:19] ENGINE Bus STOPPED -2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Bus EXITING -2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Bus EXITED -2024-05-01 11:02:19,267:INFO:[01/May/2024:11:02:19] ENGINE Waiting for child threads to terminate... -2024-05-01 11:03:16,652:INFO:[01/May/2024:11:03:16] ENGINE Listening for SIGTERM. -2024-05-01 11:03:16,655:INFO:[01/May/2024:11:03:16] ENGINE Bus STARTING -2024-05-01 11:03:16,657:INFO:[01/May/2024:11:03:16] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:03:16,883:INFO:[01/May/2024:11:03:16] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:03:16,883:INFO:[01/May/2024:11:03:16] ENGINE Bus STARTED -2024-05-01 11:03:31,558:INFO:127.0.0.1 - - [01/May/2024:11:03:31] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 11:03:37,780:INFO:[01/May/2024:11:03:37] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 11:03:37,795:INFO:[01/May/2024:11:03:37] ENGINE Bus STOPPING -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus STOPPED -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITING -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Bus EXITED -2024-05-01 11:03:37,947:INFO:[01/May/2024:11:03:37] ENGINE Waiting for child threads to terminate... -2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Listening for SIGTERM. -2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Bus STARTING -2024-05-01 11:50:03,316:INFO:[01/May/2024:11:50:03] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:50:03,530:INFO:[01/May/2024:11:50:03] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:50:03,531:INFO:[01/May/2024:11:50:03] ENGINE Bus STARTED -2024-05-01 11:50:08,550:INFO:127.0.0.1 - - [01/May/2024:11:50:08] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 11:51:32,784:INFO:[01/May/2024:11:51:32] ENGINE Bus STOPPING -2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus STOPPED -2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus EXITING -2024-05-01 11:51:32,953:INFO:[01/May/2024:11:51:32] ENGINE Bus EXITED -2024-05-01 11:51:32,981:INFO:[01/May/2024:11:51:32] ENGINE Waiting for child threads to terminate... -2024-05-01 11:51:32,981:INFO:[01/May/2024:11:51:32] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-01 11:51:46,471:INFO:[01/May/2024:11:51:46] ENGINE Listening for SIGTERM. -2024-05-01 11:51:46,471:INFO:[01/May/2024:11:51:46] ENGINE Bus STARTING -2024-05-01 11:51:46,474:INFO:[01/May/2024:11:51:46] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:51:46,681:INFO:[01/May/2024:11:51:46] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:51:46,681:INFO:[01/May/2024:11:51:46] ENGINE Bus STARTED -2024-05-01 11:51:51,993:ERROR:[01/May/2024:11:51:51] HTTP -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond - self._do_respond(path_info) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond - response.body = self.handler() - ^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ - self.body = self.oldhandler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler - value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ - return self.callable(*self.args, **self.kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 57, in history - return {"history": self.get_history()} - ^^^^^^^^^^^^^^^^ -AttributeError: 'MeasurementAPI' object has no attribute 'get_history' -2024-05-01 11:51:52,115:INFO:[01/May/2024:11:51:52] HTTP -Request Headers: - Remote-Addr: 127.0.0.1 - USER-AGENT: PostmanRuntime/7.37.3 - ACCEPT: */* - CACHE-CONTROL: no-cache - POSTMAN-TOKEN: 77dd2d1e-9704-4501-b1a5-f7e146207e55 - HOST: localhost:8080 - ACCEPT-ENCODING: gzip, deflate, br - CONNECTION: keep-alive -2024-05-01 11:51:52,120:INFO:127.0.0.1 - - [01/May/2024:11:51:52] "GET /history HTTP/1.1" 500 2189 "" "PostmanRuntime/7.37.3" -2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 11:54:21,868:INFO:[01/May/2024:11:54:21] ENGINE Bus STOPPING -2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus STOPPED -2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus EXITING -2024-05-01 11:54:22,040:INFO:[01/May/2024:11:54:22] ENGINE Bus EXITED -2024-05-01 11:54:22,123:INFO:[01/May/2024:11:54:22] ENGINE Waiting for child threads to terminate... -2024-05-01 11:54:22,123:INFO:[01/May/2024:11:54:22] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-01 11:54:22,578:INFO:[01/May/2024:11:54:22] ENGINE Listening for SIGTERM. -2024-05-01 11:54:22,578:INFO:[01/May/2024:11:54:22] ENGINE Bus STARTING -2024-05-01 11:54:22,585:INFO:[01/May/2024:11:54:22] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:54:22,797:INFO:[01/May/2024:11:54:22] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:54:22,797:INFO:[01/May/2024:11:54:22] ENGINE Bus STARTED -2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Listening for SIGTERM. -2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Bus STARTING -2024-05-01 11:56:31,186:INFO:[01/May/2024:11:56:31] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:56:32,325:ERROR:[01/May/2024:11:56:32] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-01 11:56:32,327:ERROR:[01/May/2024:11:56:32] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-01 11:56:32,327:INFO:[01/May/2024:11:56:32] ENGINE Bus STOPPING -2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus STOPPED -2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus EXITING -2024-05-01 11:56:32,329:INFO:[01/May/2024:11:56:32] ENGINE Bus EXITED -2024-05-01 11:56:57,378:INFO:[01/May/2024:11:56:57] ENGINE Listening for SIGTERM. -2024-05-01 11:56:57,378:INFO:[01/May/2024:11:56:57] ENGINE Bus STARTING -2024-05-01 11:56:57,384:INFO:[01/May/2024:11:56:57] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 11:56:57,608:INFO:[01/May/2024:11:56:57] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 11:56:57,608:INFO:[01/May/2024:11:56:57] ENGINE Bus STARTED -2024-05-01 11:57:11,420:ERROR:[01/May/2024:11:57:11] HTTP -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond - self._do_respond(path_info) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond - response.body = self.handler() - ^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ - self.body = self.oldhandler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler - value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ - return self.callable(*self.args, **self.kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 57, in history - return {"history": self.DbCrudOpearations.get_history()} - ^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'MeasurementAPI' object has no attribute 'DbCrudOpearations' -2024-05-01 11:57:11,429:INFO:[01/May/2024:11:57:11] HTTP -Request Headers: - Remote-Addr: 127.0.0.1 - USER-AGENT: PostmanRuntime/7.37.3 - ACCEPT: */* - CACHE-CONTROL: no-cache - POSTMAN-TOKEN: 383b524c-555f-4e8f-acd0-3936c805d21a - HOST: localhost:8080 - ACCEPT-ENCODING: gzip, deflate, br - CONNECTION: keep-alive -2024-05-01 11:57:11,429:INFO:127.0.0.1 - - [01/May/2024:11:57:11] "GET /history HTTP/1.1" 500 2219 "" "PostmanRuntime/7.37.3" -2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 12:10:44,103:INFO:[01/May/2024:12:10:44] ENGINE Bus STOPPING -2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus STOPPED -2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus EXITING -2024-05-01 12:10:44,224:INFO:[01/May/2024:12:10:44] ENGINE Bus EXITED -2024-05-01 12:10:44,297:INFO:[01/May/2024:12:10:44] ENGINE Waiting for child threads to terminate... -2024-05-01 12:10:44,297:INFO:[01/May/2024:12:10:44] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-01 12:10:44,788:INFO:[01/May/2024:12:10:44] ENGINE Listening for SIGTERM. -2024-05-01 12:10:44,788:INFO:[01/May/2024:12:10:44] ENGINE Bus STARTING -2024-05-01 12:10:44,795:INFO:[01/May/2024:12:10:44] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 12:10:45,011:INFO:[01/May/2024:12:10:45] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 12:10:45,012:INFO:[01/May/2024:12:10:45] ENGINE Bus STARTED -2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\db_utils\db_crud_operations.py changed. -2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 12:11:02,009:INFO:[01/May/2024:12:11:02] ENGINE Bus STOPPING -2024-05-01 12:11:02,133:INFO:[01/May/2024:12:11:02] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus STOPPED -2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus EXITING -2024-05-01 12:11:02,134:INFO:[01/May/2024:12:11:02] ENGINE Bus EXITED -2024-05-01 12:11:02,205:INFO:[01/May/2024:12:11:02] ENGINE Waiting for child threads to terminate... -2024-05-01 12:11:02,205:INFO:[01/May/2024:12:11:02] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-01 12:11:02,714:INFO:[01/May/2024:12:11:02] ENGINE Listening for SIGTERM. -2024-05-01 12:11:02,715:INFO:[01/May/2024:12:11:02] ENGINE Bus STARTING -2024-05-01 12:11:02,716:INFO:[01/May/2024:12:11:02] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 12:11:02,959:INFO:[01/May/2024:12:11:02] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 12:11:02,959:INFO:[01/May/2024:12:11:02] ENGINE Bus STARTED -2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Listening for SIGTERM. -2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Bus STARTING -2024-05-01 12:11:10,701:INFO:[01/May/2024:12:11:10] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 12:11:11,709:ERROR:[01/May/2024:12:11:11] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-01 12:11:11,709:ERROR:[01/May/2024:12:11:11] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus STOPPING -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus STOPPED -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus EXITING -2024-05-01 12:11:11,718:INFO:[01/May/2024:12:11:11] ENGINE Bus EXITED -2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Listening for SIGTERM. -2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Bus STARTING -2024-05-01 12:11:25,904:INFO:[01/May/2024:12:11:25] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 12:11:26,109:INFO:[01/May/2024:12:11:26] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 12:11:26,111:INFO:[01/May/2024:12:11:26] ENGINE Bus STARTED -2024-05-01 12:11:33,011:INFO:127.0.0.1 - - [01/May/2024:12:11:33] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 12:55:40,618:INFO:[01/May/2024:12:55:40] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 12:55:40,618:INFO:[01/May/2024:12:55:40] ENGINE Bus STOPPING -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus STOPPED -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus EXITING -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Bus EXITED -2024-05-01 12:55:40,775:INFO:[01/May/2024:12:55:40] ENGINE Waiting for child threads to terminate... -2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Listening for SIGTERM. -2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Bus STARTING -2024-05-01 13:54:10,526:INFO:[01/May/2024:13:54:10] ENGINE Started monitor thread 'Autoreloader'. -2024-05-01 13:54:10,741:INFO:[01/May/2024:13:54:10] ENGINE Serving on http://0.0.0.0:8080 -2024-05-01 13:54:10,741:INFO:[01/May/2024:13:54:10] ENGINE Bus STARTED -2024-05-01 13:54:16,217:INFO:127.0.0.1 - - [01/May/2024:13:54:16] "GET /history HTTP/1.1" 200 152 "" "PostmanRuntime/7.37.3" -2024-05-01 13:56:21,428:INFO:[01/May/2024:13:56:21] ENGINE Keyboard Interrupt: shutting down bus -2024-05-01 13:56:21,428:INFO:[01/May/2024:13:56:21] ENGINE Bus STOPPING -2024-05-01 13:56:21,633:INFO:[01/May/2024:13:56:21] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-01 13:56:21,634:INFO:[01/May/2024:13:56:21] ENGINE Stopped thread 'Autoreloader'. -2024-05-01 13:56:21,635:INFO:[01/May/2024:13:56:21] ENGINE Bus STOPPED -2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITING -2024-05-01 13:56:21,636:INFO:[01/May/2024:13:56:21] ENGINE Bus EXITED -2024-05-01 13:56:21,637:INFO:[01/May/2024:13:56:21] ENGINE Waiting for child threads to terminate... -2024-05-02 09:07:07,026:INFO:[02/May/2024:09:07:07] ENGINE Listening for SIGTERM. -2024-05-02 09:07:07,026:INFO:[02/May/2024:09:07:07] ENGINE Bus STARTING -2024-05-02 09:07:07,028:INFO:[02/May/2024:09:07:07] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:07:07,262:INFO:[02/May/2024:09:07:07] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:07:07,262:INFO:[02/May/2024:09:07:07] ENGINE Bus STARTED -2024-05-02 09:07:25,101:ERROR:[02/May/2024:09:07:25] HTTP -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond - self._do_respond(path_info) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond - response.body = self.handler() - ^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ - self.body = self.oldhandler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler - value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ - return self.callable(*self.args, **self.kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 62, in convert - self.add_to_history(processed_result_obj) - ^^^^^^^^^^^^^^^^^^^ -AttributeError: 'MeasurementAPI' object has no attribute 'add_to_history' -2024-05-02 09:07:25,190:INFO:[02/May/2024:09:07:25] HTTP -Request Headers: - Remote-Addr: 127.0.0.1 - HOST: localhost:8080 - CONNECTION: keep-alive - SEC-CH-UA: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" - SEC-CH-UA-MOBILE: ?0 - SEC-CH-UA-PLATFORM: "Windows" - UPGRADE-INSECURE-REQUESTS: 1 - USER-AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 - ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 - SEC-FETCH-SITE: none - SEC-FETCH-MODE: navigate - SEC-FETCH-USER: ?1 - SEC-FETCH-DEST: document - ACCEPT-ENCODING: gzip, deflate, br, zstd - ACCEPT-LANGUAGE: en-US,en;q=0.9,ar;q=0.8 -2024-05-02 09:07:25,198:INFO:127.0.0.1 - - [02/May/2024:09:07:25] "GET /convert?input_str=ab HTTP/1.1" 500 2179 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:09:54,943:INFO:[02/May/2024:09:09:54] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:09:54,944:INFO:[02/May/2024:09:09:54] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:09:54,944:INFO:[02/May/2024:09:09:54] ENGINE Bus STOPPING -2024-05-02 09:09:55,124:INFO:[02/May/2024:09:09:55] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:09:55,124:INFO:[02/May/2024:09:09:55] ENGINE Bus STOPPED -2024-05-02 09:09:55,126:INFO:[02/May/2024:09:09:55] ENGINE Bus EXITING -2024-05-02 09:09:55,126:INFO:[02/May/2024:09:09:55] ENGINE Bus EXITED -2024-05-02 09:09:55,212:INFO:[02/May/2024:09:09:55] ENGINE Waiting for child threads to terminate... -2024-05-02 09:09:55,225:INFO:[02/May/2024:09:09:55] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Listening for SIGTERM. -2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Bus STARTING -2024-05-02 09:09:56,199:INFO:[02/May/2024:09:09:56] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:09:56,413:INFO:[02/May/2024:09:09:56] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:09:56,413:INFO:[02/May/2024:09:09:56] ENGINE Bus STARTED -2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:13:41,851:INFO:[02/May/2024:09:13:41] ENGINE Bus STOPPING -2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE Bus STOPPED -2024-05-02 09:13:42,011:INFO:[02/May/2024:09:13:42] ENGINE Bus EXITING -2024-05-02 09:13:42,013:INFO:[02/May/2024:09:13:42] ENGINE Bus EXITED -2024-05-02 09:13:42,050:INFO:[02/May/2024:09:13:42] ENGINE Waiting for child threads to terminate... -2024-05-02 09:13:42,052:INFO:[02/May/2024:09:13:42] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Listening for SIGTERM. -2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Bus STARTING -2024-05-02 09:13:42,511:INFO:[02/May/2024:09:13:42] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:13:42,743:INFO:[02/May/2024:09:13:42] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:13:42,743:INFO:[02/May/2024:09:13:42] ENGINE Bus STARTED -2024-05-02 09:13:53,021:INFO:127.0.0.1 - - [02/May/2024:09:13:53] "GET /convert?input_str=ab HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:14:00,854:INFO:127.0.0.1 - - [02/May/2024:09:14:00] "GET /convert?input_str=aa HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:14:13,026:INFO:127.0.0.1 - - [02/May/2024:09:14:13] "GET /convert?input_str=aaa HTTP/1.1" 200 34 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:14:24,455:INFO:127.0.0.1 - - [02/May/2024:09:14:24] "GET /convert?input_str=aa HTTP/1.1" 200 30 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:14:50,218:INFO:127.0.0.1 - - [02/May/2024:09:14:50] "GET /history HTTP/1.1" 200 292 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" -2024-05-02 09:22:02,372:INFO:[02/May/2024:09:22:02] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:22:02,379:INFO:[02/May/2024:09:22:02] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:22:02,379:INFO:[02/May/2024:09:22:02] ENGINE Bus STOPPING -2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus STOPPED -2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus EXITING -2024-05-02 09:22:02,500:INFO:[02/May/2024:09:22:02] ENGINE Bus EXITED -2024-05-02 09:22:02,580:INFO:[02/May/2024:09:22:02] ENGINE Waiting for child threads to terminate... -2024-05-02 09:22:02,580:INFO:[02/May/2024:09:22:02] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Listening for SIGTERM. -2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Bus STARTING -2024-05-02 09:22:03,089:INFO:[02/May/2024:09:22:03] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:22:03,291:INFO:[02/May/2024:09:22:03] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:22:03,291:INFO:[02/May/2024:09:22:03] ENGINE Bus STARTED -2024-05-02 09:22:08,270:INFO:127.0.0.1 - - [02/May/2024:09:22:08] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" -2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:25:57,605:INFO:[02/May/2024:09:25:57] ENGINE Bus STOPPING -2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus STOPPED -2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus EXITING -2024-05-02 09:25:57,777:INFO:[02/May/2024:09:25:57] ENGINE Bus EXITED -2024-05-02 09:25:57,841:INFO:[02/May/2024:09:25:57] ENGINE Waiting for child threads to terminate... -2024-05-02 09:25:57,841:INFO:[02/May/2024:09:25:57] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:25:58,626:INFO:[02/May/2024:09:25:58] ENGINE Listening for SIGTERM. -2024-05-02 09:25:58,626:INFO:[02/May/2024:09:25:58] ENGINE Bus STARTING -2024-05-02 09:25:58,642:INFO:[02/May/2024:09:25:58] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:25:58,856:INFO:[02/May/2024:09:25:58] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:25:58,856:INFO:[02/May/2024:09:25:58] ENGINE Bus STARTED -2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:26:50,430:INFO:[02/May/2024:09:26:50] ENGINE Bus STOPPING -2024-05-02 09:26:50,548:INFO:[02/May/2024:09:26:50] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:26:50,549:INFO:[02/May/2024:09:26:50] ENGINE Bus STOPPED -2024-05-02 09:26:50,550:INFO:[02/May/2024:09:26:50] ENGINE Bus EXITING -2024-05-02 09:26:50,550:INFO:[02/May/2024:09:26:50] ENGINE Bus EXITED -2024-05-02 09:26:50,557:INFO:[02/May/2024:09:26:50] ENGINE Waiting for child threads to terminate... -2024-05-02 09:26:50,557:INFO:[02/May/2024:09:26:50] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Listening for SIGTERM. -2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Bus STARTING -2024-05-02 09:26:51,064:INFO:[02/May/2024:09:26:51] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:26:51,300:INFO:[02/May/2024:09:26:51] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:26:51,302:INFO:[02/May/2024:09:26:51] ENGINE Bus STARTED -2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:26:54,112:INFO:[02/May/2024:09:26:54] ENGINE Bus STOPPING -2024-05-02 09:26:54,258:INFO:[02/May/2024:09:26:54] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:26:54,259:INFO:[02/May/2024:09:26:54] ENGINE Bus STOPPED -2024-05-02 09:26:54,261:INFO:[02/May/2024:09:26:54] ENGINE Bus EXITING -2024-05-02 09:26:54,261:INFO:[02/May/2024:09:26:54] ENGINE Bus EXITED -2024-05-02 09:26:54,318:INFO:[02/May/2024:09:26:54] ENGINE Waiting for child threads to terminate... -2024-05-02 09:26:54,318:INFO:[02/May/2024:09:26:54] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:26:54,775:INFO:[02/May/2024:09:26:54] ENGINE Listening for SIGTERM. -2024-05-02 09:26:54,775:INFO:[02/May/2024:09:26:54] ENGINE Bus STARTING -2024-05-02 09:26:54,781:INFO:[02/May/2024:09:26:54] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:26:55,000:INFO:[02/May/2024:09:26:55] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:26:55,001:INFO:[02/May/2024:09:26:55] ENGINE Bus STARTED -2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:27:21,145:INFO:[02/May/2024:09:27:21] ENGINE Bus STOPPING -2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus STOPPED -2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus EXITING -2024-05-02 09:27:21,283:INFO:[02/May/2024:09:27:21] ENGINE Bus EXITED -2024-05-02 09:27:21,344:INFO:[02/May/2024:09:27:21] ENGINE Waiting for child threads to terminate... -2024-05-02 09:27:21,345:INFO:[02/May/2024:09:27:21] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Listening for SIGTERM. -2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Bus STARTING -2024-05-02 09:27:21,785:INFO:[02/May/2024:09:27:21] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:27:22,004:INFO:[02/May/2024:09:27:22] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:27:22,004:INFO:[02/May/2024:09:27:22] ENGINE Bus STARTED -2024-05-02 09:27:26,171:ERROR:[02/May/2024:09:27:26] HTTP -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 638, in respond - self._do_respond(path_info) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond - response.body = self.handler() - ^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\encoding.py", line 223, in __call__ - self.body = self.oldhandler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\lib\jsontools.py", line 59, in json_handler - value = cherrypy.serving.request._json_inner_handler(*args, **kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ - return self.callable(*self.args, **self.kwargs) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py", line 32, in history - return {"history": self.get_history()} - ^^^^^^^^^^^^^^^^ -AttributeError: 'MeasurementAPI' object has no attribute 'get_history' -2024-05-02 09:27:26,220:INFO:[02/May/2024:09:27:26] HTTP -Request Headers: - Remote-Addr: 127.0.0.1 - USER-AGENT: PostmanRuntime/7.37.3 - ACCEPT: */* - CACHE-CONTROL: no-cache - POSTMAN-TOKEN: c84243c6-8a83-4d81-be55-25d1256c4b00 - HOST: localhost:8080 - ACCEPT-ENCODING: gzip, deflate, br - CONNECTION: keep-alive - Content-Length: 0 -2024-05-02 09:27:26,226:INFO:127.0.0.1 - - [02/May/2024:09:27:26] "POST /history HTTP/1.1" 500 2189 "" "PostmanRuntime/7.37.3" -2024-05-02 09:27:57,330:INFO:[02/May/2024:09:27:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:27:57,330:INFO:[02/May/2024:09:27:57] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:27:57,331:INFO:[02/May/2024:09:27:57] ENGINE Bus STOPPING -2024-05-02 09:27:57,529:INFO:[02/May/2024:09:27:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus STOPPED -2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus EXITING -2024-05-02 09:27:57,531:INFO:[02/May/2024:09:27:57] ENGINE Bus EXITED -2024-05-02 09:27:57,603:INFO:[02/May/2024:09:27:57] ENGINE Waiting for child threads to terminate... -2024-05-02 09:27:57,603:INFO:[02/May/2024:09:27:57] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Listening for SIGTERM. -2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Bus STARTING -2024-05-02 09:27:58,083:INFO:[02/May/2024:09:27:58] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:27:58,306:INFO:[02/May/2024:09:27:58] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:27:58,308:INFO:[02/May/2024:09:27:58] ENGINE Bus STARTED -2024-05-02 09:28:01,747:INFO:127.0.0.1 - - [02/May/2024:09:28:01] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" -2024-05-02 09:29:12,293:INFO:[02/May/2024:09:29:12] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:29:12,294:INFO:[02/May/2024:09:29:12] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:29:12,294:INFO:[02/May/2024:09:29:12] ENGINE Bus STOPPING -2024-05-02 09:29:12,425:INFO:[02/May/2024:09:29:12] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:29:12,425:INFO:[02/May/2024:09:29:12] ENGINE Bus STOPPED -2024-05-02 09:29:12,426:INFO:[02/May/2024:09:29:12] ENGINE Bus EXITING -2024-05-02 09:29:12,426:INFO:[02/May/2024:09:29:12] ENGINE Bus EXITED -2024-05-02 09:29:12,455:INFO:[02/May/2024:09:29:12] ENGINE Waiting for child threads to terminate... -2024-05-02 09:29:12,455:INFO:[02/May/2024:09:29:12] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:29:13,010:INFO:[02/May/2024:09:29:13] ENGINE Listening for SIGTERM. -2024-05-02 09:29:13,016:INFO:[02/May/2024:09:29:13] ENGINE Bus STARTING -2024-05-02 09:29:13,016:INFO:[02/May/2024:09:29:13] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:29:13,252:INFO:[02/May/2024:09:29:13] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:29:13,252:INFO:[02/May/2024:09:29:13] ENGINE Bus STARTED -2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:31:24,898:INFO:[02/May/2024:09:31:24] ENGINE Bus STOPPING -2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus STOPPED -2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus EXITING -2024-05-02 09:31:25,037:INFO:[02/May/2024:09:31:25] ENGINE Bus EXITED -2024-05-02 09:31:25,100:INFO:[02/May/2024:09:31:25] ENGINE Waiting for child threads to terminate... -2024-05-02 09:31:25,100:INFO:[02/May/2024:09:31:25] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Listening for SIGTERM. -2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Bus STARTING -2024-05-02 09:31:25,506:INFO:[02/May/2024:09:31:25] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:31:25,723:INFO:[02/May/2024:09:31:25] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:31:25,724:INFO:[02/May/2024:09:31:25] ENGINE Bus STARTED -2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Listening for SIGTERM. -2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Bus STARTING -2024-05-02 09:31:50,144:INFO:[02/May/2024:09:31:50] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:31:51,336:ERROR:[02/May/2024:09:31:51] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-02 09:31:51,341:ERROR:[02/May/2024:09:31:51] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Bus STOPPING -2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:31:51,343:INFO:[02/May/2024:09:31:51] ENGINE Bus STOPPED -2024-05-02 09:31:51,344:INFO:[02/May/2024:09:31:51] ENGINE Bus EXITING -2024-05-02 09:31:51,344:INFO:[02/May/2024:09:31:51] ENGINE Bus EXITED -2024-05-02 09:32:05,402:INFO:[02/May/2024:09:32:05] ENGINE Listening for SIGTERM. -2024-05-02 09:32:05,402:INFO:[02/May/2024:09:32:05] ENGINE Bus STARTING -2024-05-02 09:32:05,418:INFO:[02/May/2024:09:32:05] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:32:06,506:ERROR:[02/May/2024:09:32:06] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-02 09:32:06,518:ERROR:[02/May/2024:09:32:06] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-02 09:32:06,520:INFO:[02/May/2024:09:32:06] ENGINE Bus STOPPING -2024-05-02 09:32:06,522:INFO:[02/May/2024:09:32:06] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus STOPPED -2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus EXITING -2024-05-02 09:32:06,523:INFO:[02/May/2024:09:32:06] ENGINE Bus EXITED -2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Listening for SIGTERM. -2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Bus STARTING -2024-05-02 09:32:20,113:INFO:[02/May/2024:09:32:20] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:32:20,332:INFO:[02/May/2024:09:32:20] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:32:20,332:INFO:[02/May/2024:09:32:20] ENGINE Bus STARTED -2024-05-02 09:32:27,460:INFO:127.0.0.1 - - [02/May/2024:09:32:27] "POST /history HTTP/1.1" 200 292 "" "PostmanRuntime/7.37.3" -2024-05-02 09:33:03,653:INFO:127.0.0.1 - - [02/May/2024:09:33:03] "POST /convert?input_str=bbf HTTP/1.1" 200 33 "" "PostmanRuntime/7.37.3" -2024-05-02 09:33:14,251:INFO:127.0.0.1 - - [02/May/2024:09:33:14] "POST /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" -2024-05-02 09:33:18,786:INFO:127.0.0.1 - - [02/May/2024:09:33:18] "GET /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" -2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Restarting because c:\Users\71528\Desktop\coding\PackageMeasurementConversionAPI\controller\measurement_controller.py changed. -2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:35:57,893:INFO:[02/May/2024:09:35:57] ENGINE Bus STOPPING -2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down -2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus STOPPED -2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus EXITING -2024-05-02 09:35:58,057:INFO:[02/May/2024:09:35:58] ENGINE Bus EXITED -2024-05-02 09:35:58,082:INFO:[02/May/2024:09:35:58] ENGINE Waiting for child threads to terminate... -2024-05-02 09:35:58,082:INFO:[02/May/2024:09:35:58] ENGINE Re-spawning C:\Users\71528\AppData\Local\Programs\Python\Python312\python.exe c:/Users/71528/Desktop/coding/PackageMeasurementConversionAPI/main.py -2024-05-02 09:35:58,553:INFO:[02/May/2024:09:35:58] ENGINE Listening for SIGTERM. -2024-05-02 09:35:58,553:INFO:[02/May/2024:09:35:58] ENGINE Bus STARTING -2024-05-02 09:35:58,559:INFO:[02/May/2024:09:35:58] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:35:58,767:INFO:[02/May/2024:09:35:58] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:35:58,768:INFO:[02/May/2024:09:35:58] ENGINE Bus STARTED -2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Listening for SIGTERM. -2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Bus STARTING -2024-05-02 09:36:14,983:INFO:[02/May/2024:09:36:14] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:36:16,073:ERROR:[02/May/2024:09:36:16] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-02 09:36:16,073:ERROR:[02/May/2024:09:36:16] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus STOPPING -2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus STOPPED -2024-05-02 09:36:16,082:INFO:[02/May/2024:09:36:16] ENGINE Bus EXITING -2024-05-02 09:36:16,085:INFO:[02/May/2024:09:36:16] ENGINE Bus EXITED -2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Listening for SIGTERM. -2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Bus STARTING -2024-05-02 09:36:25,610:INFO:[02/May/2024:09:36:25] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:36:26,747:ERROR:[02/May/2024:09:36:26] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-02 09:36:26,750:ERROR:[02/May/2024:09:36:26] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus STOPPING -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus STOPPED -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus EXITING -2024-05-02 09:36:26,750:INFO:[02/May/2024:09:36:26] ENGINE Bus EXITED -2024-05-02 09:36:32,264:INFO:[02/May/2024:09:36:32] ENGINE Listening for SIGTERM. -2024-05-02 09:36:32,264:INFO:[02/May/2024:09:36:32] ENGINE Bus STARTING -2024-05-02 09:36:32,277:INFO:[02/May/2024:09:36:32] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:36:33,369:ERROR:[02/May/2024:09:36:33] ENGINE Error in 'start' listener > -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 122, in free - Checker(timeout=0.1).assert_free(host, port) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 71, in assert_free - list(itertools.starmap(self._connect, info)) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 87, in _connect - raise PortNotFree(tmpl.format(**locals())) -portend.PortNotFree: Port 8080 is in use on 127.0.0.1. - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 230, in publish - output.append(listener(*args, **kwargs)) - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\_cpserver.py", line 180, in start - super(Server, self).start() - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\servers.py", line 177, in start - portend.free(*self.bind_addr, timeout=Timeouts.free) - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\portend.py", line 126, in free - raise Timeout("Port {port} not free on {host}.".format(**locals())) -portend.Timeout: Port 8080 not free on 0.0.0.0. - -2024-05-02 09:36:33,369:ERROR:[02/May/2024:09:36:33] ENGINE Shutting down due to error in start listener: -Traceback (most recent call last): - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 268, in start - self.publish('start') - File "C:\Users\71528\AppData\Roaming\Python\Python312\site-packages\cherrypy\process\wspbus.py", line 248, in publish - raise exc -cherrypy.process.wspbus.ChannelFailures: Timeout('Port 8080 not free on 0.0.0.0.') - -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus STOPPING -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) already shut down -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Stopped thread 'Autoreloader'. -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus STOPPED -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITING -2024-05-02 09:36:33,369:INFO:[02/May/2024:09:36:33] ENGINE Bus EXITED -2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Listening for SIGTERM. -2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Bus STARTING -2024-05-02 09:36:51,518:INFO:[02/May/2024:09:36:51] ENGINE Started monitor thread 'Autoreloader'. -2024-05-02 09:36:51,727:INFO:[02/May/2024:09:36:51] ENGINE Serving on http://0.0.0.0:8080 -2024-05-02 09:36:51,728:INFO:[02/May/2024:09:36:51] ENGINE Bus STARTED -2024-05-02 09:37:02,652:INFO:127.0.0.1 - - [02/May/2024:09:37:02] "GET /history HTTP/1.1" 200 327 "" "PostmanRuntime/7.37.3" -2024-05-02 09:37:38,231:INFO:127.0.0.1 - - [02/May/2024:09:37:38] "GET /convert?input_str=caaa HTTP/1.1" 200 55 "" "PostmanRuntime/7.37.3" diff --git a/measurements.db b/measurements.db deleted file mode 100644 index b9b9ad31498ecdbdee09203cce011c0b69b8d35a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&&q@M890%|jchzq$UL%UO-T}t~!J!R2pIrHFz#BMk$k-U)&u!bE|)Kj=E=amE92b!QR*_duC7Uk=?U9b}Nzy2tWV= z5P$##AOHafKmY;|fB*y*Dxj${Sqs)J%c>+zRgp