Commit ef07dc7b by arun.uday

commit4

parent c4ca5413
...@@ -8,6 +8,7 @@ config.read("conf/applications.conf") ...@@ -8,6 +8,7 @@ config.read("conf/applications.conf")
# path # path
base_path = config.get("path", 'base_path') base_path = config.get("path", 'base_path')
sub_path = config.get("path", "sub_path") sub_path = config.get("path", "sub_path")
full_path = base_path + sub_path
# mqtt # mqtt
......
import sqlite3 import sqlite3
from scripts.config.application_config import db_name, db_table from scripts.config.application_config import db_name, db_table, full_path
from scripts.utilis.db_queries import DbQueries from scripts.utilis.db_queries import DbQueries
class SqliteOperations: class SqliteOperations:
def __init__(self): def __init__(self):
# connecting to the database # connecting to the database
self.conn = sqlite3.connect(db_name) self.conn = sqlite3.connect(full_path + db_name)
def create_db(self): def create_db(self):
try: try:
......
...@@ -14,6 +14,7 @@ app = FastAPI() ...@@ -14,6 +14,7 @@ app = FastAPI()
@app.get("/") @app.get("/")
def receiver(): def receiver():
try:
def on_connect(client_name, userdata, flags, rc): def on_connect(client_name, userdata, flags, rc):
print(userdata, " ", flags) print(userdata, " ", flags)
print("Connected with result code " + str(rc)) print("Connected with result code " + str(rc))
...@@ -39,3 +40,6 @@ def receiver(): ...@@ -39,3 +40,6 @@ def receiver():
client.on_connect = on_connect client.on_connect = on_connect
client.on_message = on_message client.on_message = on_message
client.loop_forever() client.loop_forever()
except Exception as e:
print(e)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment