Commit 53073373 authored by arun.uday's avatar arun.uday

AssetManager- V1.0- Not reviewed

Updated cookie storage and authentication, completed user management(create, update, view and delete), create download API for dashboard
parent 2649adbb
...@@ -4,7 +4,7 @@ DB_NAME=userDB ...@@ -4,7 +4,7 @@ DB_NAME=userDB
REDIS_URI=redis://127.0.0.1:6379 REDIS_URI=redis://127.0.0.1:6379
REDIS_LOGIN_DB=10 REDIS_LOGIN_DB=10
SERVICE_HOST=127.0.0.1 SERVICE_HOST=0.0.0.0
SERVICE_PORT=8671 SERVICE_PORT=8671
PROJECT_NAME=AssetManager PROJECT_NAME=AssetManager
...@@ -12,4 +12,5 @@ PROJECT_NAME=AssetManager ...@@ -12,4 +12,5 @@ PROJECT_NAME=AssetManager
BASE_PATH=scripts/ BASE_PATH=scripts/
SUB_PATH=log/ SUB_PATH=log/
ENCODING_TYPE=utf-8 ENCODING_TYPE=utf-8
\ No newline at end of file KEY_ENCRYPTION=kliLensKLiLensKL
\ No newline at end of file
...@@ -37,7 +37,7 @@ class _PathConf: ...@@ -37,7 +37,7 @@ class _PathConf:
class _Secrets(BaseSettings): class _Secrets(BaseSettings):
ACCESS_TOKEN_EXPIRE_MINUTES = 30 ACCESS_TOKEN_EXPIRE_MINUTES = 30
leeway_in_minutes: int = 10 leeway_in_minutes: int = 10
KEY_ENCRYPTION = "kliLensKLiLensKL" KEY_ENCRYPTION: str
issuer: str = "iotManager" issuer: str = "iotManager"
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7" SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
ALGORITHM = "HS256" ALGORITHM = "HS256"
......
...@@ -8,6 +8,8 @@ class ApiEndPoints: ...@@ -8,6 +8,8 @@ class ApiEndPoints:
view: str = "/view" view: str = "/view"
update: str = "/update" update: str = "/update"
delete: str = "/delete" delete: str = "/delete"
header: str = "/header"
download: str = "/download"
# login-management # login-management
asset_manager_login: str = "/login" asset_manager_login: str = "/login"
...@@ -19,3 +21,8 @@ class ApiEndPoints: ...@@ -19,3 +21,8 @@ class ApiEndPoints:
asset_manager_user_view: str = asset_manager_user_management + view asset_manager_user_view: str = asset_manager_user_management + view
asset_manager_user_update: str = asset_manager_user_management + update asset_manager_user_update: str = asset_manager_user_management + update
asset_manager_user_delete: str = asset_manager_user_management + delete asset_manager_user_delete: str = asset_manager_user_management + delete
# dashboard-management
asset_manager_dashboard: str = "/dashboard"
asset_manager_dashboard_download_header: str = asset_manager_dashboard + download + header
asset_manager_dashboard_download: str = asset_manager_dashboard + download
from fastapi.responses import JSONResponse
from fastapi import status
from scripts.schemas.default_responses import DefaultResponse
class DashboardManagement:
def __init__(self):
self.download_files = {
"SCN101-Manual (Local Config with IoTSetupUI)":
"https://ilens.io/DownloadFiles/SCN_Device_Configuration_Page_Updates_4_7.pdf",
"SCN101 Firmware 4.7 Updates":
"https://ilens.io/DownloadFiles/SCN101Manual.pdf",
"IoTSetupUI":
"https://ilens.io/DownloadFiles/IoTsetupUI-V1.6.zip",
"CP2102 SCN Windows USB Driver":
"https://ilens.io/DownloadFiles/CP2102_Windows.zip",
"SCNFirmwareBurner":
"https://ilens.io/DownloadFiles/flash_download_tool_v3.8.5.zip",
"SCN101A Firmware - V2.7 (Board: 1.4, 1.6 and 4MB Part.) ":
"https://ilens.io/DownloadFiles/SCN101_Firmware_V2_7_B1_6.bin",
"SCN101A Firmware - V2.8 (Board: 1.4, 1.6 and 4MB Part.) ":
"https://ilens.io/DownloadFiles/SCN101_Firmware_V2_8_B1_6.bin",
"SCN101A4G (SCN Relay, 4G, SCN201 and SCN101L) Firmware - V4.5 (16MB Part.) ":
"https://ilens.io/DownloadFiles/SCN101_R_A4G_SCN201_Firmware_V4_5.bin",
"SCN101A4G (SCN Relay, 4G, SCN201 and SCN101L) Firmware - V4.6 (16MB Part.) ":
"https://ilens.io/DownloadFiles/SCN101_R_A4G_SCN201_Firmware_V4_6.bin",
"SCN101A4G (SCN Relay, 4G, SCN201 and SCN101L) Firmware - V4.7 (16MB Part.) ":
"https://ilens.io/DownloadFiles/SCN101_R_A4G_SCN201_Firmware_V4_7.bin",
"P10_LED_Driver_V2.1 (Board 1.1)":
"https://ilens.io/DownloadFiles/P10_LED_Driver_V2.1.bin",
"SCN-LED Reset Firmware (Board 1.1)":
"https://ilens.io/DownloadFiles/SCN-LED_Reset.bin",
"SCN Reset Firmware (Partition: 4MB)":
"https://ilens.io/DownloadFiles/SCN_Reset_4MB_Part.bin",
"SCN Reset Firmware (Partition: 16MB)":
"https://ilens.io/DownloadFiles/SCN_Reset_16MB_Part.bin"
}
def download_header(self):
data = {
"actions": [
{
"class": "fa-download",
"action": "download",
"tooltip": "Download"
}
],
"column_defs": []
}
print(data["column_defs"])
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
print(column_values)
data["column_defs"].append(column_values)
print(data)
return JSONResponse(
content=DefaultResponse(status="success", message="Fetched Successfully",
data=data).dict(),
status_code=status.HTTP_200_OK)
@staticmethod
def download_details():
return JSONResponse(
content=DefaultResponse(status="success", message="Fetched Successfully",
data=download_files).dict(),
status_code=status.HTTP_200_OK)
from fastapi import Response
from scripts.core.handlers.normal_login import NormalLogin from scripts.core.handlers.normal_login import NormalLogin
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from fastapi import status from fastapi import status
...@@ -16,36 +18,38 @@ class LoginHandlers: ...@@ -16,36 +18,38 @@ class LoginHandlers:
self.login_type = "normal" self.login_type = "normal"
# decrypting the password from the UI # decrypting the password from the UI
decrypted_password = self.pass_decrypt.password_decrypt(user_data.password) decrypted_password = self.pass_decrypt.password_decrypt(user_data.password)
# validating the received inputs empty or not # validating the received inputs empty or not
response = self.obj_login_handler.user_data_validation( responses = self.obj_login_handler.user_data_validation(
user_data.email, user_data.email,
decrypted_password) decrypted_password.split("\"")[1])
# Account is not registered # Account is not registered
if response is not None: if responses is not None:
return JSONResponse(content=DefaultFailureResponse(error=response).dict(), return JSONResponse(content=DefaultFailureResponse(status="failed",
status_code=status.HTTP_400_BAD_REQUEST) message=responses).dict(),
status_code=status.HTTP_200_OK)
# checking for the account and password matching # checking for the account and password matching
response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data, user_data_response, data = self.obj_login_handler.db_password_matching(self.login_type, user_data,
decrypted_password) decrypted_password.split("\"")[1])
# if the passwords doesn't match with the db data # if the passwords doesn't match with the db data
if response is not None: if user_data_response is not None:
return JSONResponse(content=DefaultFailureResponse(error=data).dict(), return JSONResponse(content=DefaultFailureResponse(status="failed",
status_code=status.HTTP_401_UNAUTHORIZED) message=data).dict(),
status_code=status.HTTP_200_OK)
# generating the access tokens # generating the access tokens
response = self.obj_login_handler.generate_cookie_tokens(user_data, request) responses, exp = self.obj_login_handler.generate_cookie_tokens(user_data, request)
# token generation unsuccessful # token generation unsuccessful
if response is None: if responses is None:
return JSONResponse( return JSONResponse(
content=DefaultFailureResponse(message="Access Unsuccessful", content=DefaultFailureResponse(status="failed",
error=ErrorMessages.ERROR_TOKEN_GENERATION).dict(), message=ErrorMessages.ERROR_TOKEN_GENERATION).dict(),
status_code=status.HTTP_403_FORBIDDEN) status_code=status.HTTP_200_OK)
# sending successful response to UI # sending successful response to UI
return JSONResponse( response = JSONResponse(
content=DefaultResponse(message="Login Successful", data=response).dict(), content=DefaultResponse(status="success", message="Logged In Successfully", data=data).dict(),
status_code=status.HTTP_200_OK) status_code=status.HTTP_200_OK, headers={"Content-Type": "application/json"})
response.set_cookie(key="login-token", value=responses, expires=exp)
return response
# v1 # v1
def google_login(self, request): def google_login(self, request):
......
...@@ -5,6 +5,7 @@ from datetime import datetime ...@@ -5,6 +5,7 @@ from datetime import datetime
from passlib.context import CryptContext from passlib.context import CryptContext
from validate_email import validate_email from validate_email import validate_email
from scripts.config import Secrets
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
...@@ -24,10 +25,10 @@ class NormalLogin: ...@@ -24,10 +25,10 @@ class NormalLogin:
try: try:
# checking for valid username # checking for valid username
if email == "" or validate_email(email) is not True: if email == "" or validate_email(email) is not True:
return {"message": ErrorMessages.ERROR_INVALID_EMAIL, "data": email} return ErrorMessages.ERROR_INVALID_EMAIL
# checking for valid password # checking for valid password
if password == "": if password == "":
return {"message": ErrorMessages.ERROR_INVALID_PASSWORD, "data": password} return ErrorMessages.ERROR_INVALID_PASSWORD
return None return None
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -38,13 +39,11 @@ class NormalLogin: ...@@ -38,13 +39,11 @@ class NormalLogin:
self.db_user_data = MongoUser().fetch_one_user_details(email) self.db_user_data = MongoUser().fetch_one_user_details(email)
# if the user is not available # if the user is not available
if not self.db_user_data: if not self.db_user_data:
return False, {"message": ErrorMessages.ERROR_UNAUTHORIZED_USER_LOGIN, return False, ErrorMessages.ERROR_UNAUTHORIZED_USER_LOGIN
"data": {"username": email}}
# if the user is not registered through normal login # if the user is not registered through normal login
if self.db_user_data["login_type"] != login_type: if self.db_user_data["login_type"] != login_type:
return False, {"message": ErrorMessages.ERROR_LOGIN_TYPE_INVALID, return False, ErrorMessages.ERROR_LOGIN_TYPE_INVALID
"data": {"username": email, "Use Login": self.db_user_data["login_type"]}}
# if the user exist # if the user exist
return None, {"message": True} return None, {"message": True}
except Exception as e: except Exception as e:
...@@ -59,8 +58,7 @@ class NormalLogin: ...@@ -59,8 +58,7 @@ class NormalLogin:
return response, message return response, message
# if the user exists in db then password is matched # if the user exists in db then password is matched
if not self.pwd_context.verify(password, self.db_user_data["password"]): if not self.pwd_context.verify(password, self.db_user_data["password"]):
return False, {"message": ErrorMessages.ERROR_PASSWORD_MISMATCH, return False, ErrorMessages.ERROR_PASSWORD_MISMATCH
"data": {"username": user_data.email}}
# if the password is correct # if the password is correct
return None, {"username": user_data.email, "role": self.db_user_data["user_role"]} return None, {"username": user_data.email, "role": self.db_user_data["user_role"]}
except Exception as e: except Exception as e:
...@@ -70,13 +68,14 @@ class NormalLogin: ...@@ -70,13 +68,14 @@ class NormalLogin:
def generate_cookie_tokens(user_data, request): def generate_cookie_tokens(user_data, request):
try: try:
# creating the access token # creating the access token
access_token = create_token( access_token, exp = create_token(
user_id=user_data.email, user_id=user_data.email,
ip=request.ip_address login_token=Secrets.SECRET_KEY,
ip=request.client.host
) )
# returning the login token # returning the login token
if access_token: if access_token:
return {"user_id": access_token, "token_type": "bearer"} return access_token, exp
else: else:
return None return None
except Exception as e: except Exception as e:
......
...@@ -3,6 +3,9 @@ import datetime ...@@ -3,6 +3,9 @@ import datetime
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from fastapi.responses import JSONResponse
from fastapi import status
from scripts.schemas.default_responses import DefaultResponse, DefaultFailureResponse
from scripts.utils.security.password_util import EncryptDecryptPassword from scripts.utils.security.password_util import EncryptDecryptPassword
from scripts.utils.validations_util import UserDataValidations from scripts.utils.validations_util import UserDataValidations
...@@ -16,11 +19,11 @@ class UserManagement: ...@@ -16,11 +19,11 @@ class UserManagement:
# for normal registration using email and password # for normal registration using email and password
def normal_register(self, user_data): def normal_register(self, user_data):
try: try:
response, message = UserDataValidations.data_validation(user_data, 'normal', self.method) response, message = UserDataValidations.register_data_validation(user_data, 'normal', self.method)
if not response: if not response:
return message return message
# fetching the data based on the username # fetching the data based on the username
db_user_data = MongoUser().fetch_one_user_details(user_data.email) db_user_data = obj_mongo_user.fetch_one_user_details(user_data.email)
# if the user is not available # if the user is not available
if db_user_data: if db_user_data:
return {"message": ErrorMessages.ERROR_EMAIL_EXIST, return {"message": ErrorMessages.ERROR_EMAIL_EXIST,
...@@ -55,10 +58,84 @@ class UserManagement: ...@@ -55,10 +58,84 @@ class UserManagement:
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
# update user details
def update_user_details(self, email, update_data):
try:
self.method = "update"
db_user_data = obj_mongo_user.fetch_one_user_details(email)
# if the user is not available
if db_user_data is None:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_ID_DOESNT_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND)
if update_data.email is not None:
db_user_data = obj_mongo_user.fetch_one_user_details(update_data.email)
# if the user is not available
if db_user_data is not None:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND)
filter_data_updated = {"email": email}
update_data_removed = {key: value for key, value in update_data if value is not None}
response, message = UserDataValidations.update_data_validation(update_data)
if not response:
return message
response = obj_mongo_user.update_user(filter_data_updated, update_data_removed)
if not response:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_IN_UPDATING).dict(),
status_code=status.HTTP_200_OK)
return JSONResponse(
content=DefaultResponse(status="success", message="Updated Successfully",
data=update_data_removed).dict(),
status_code=status.HTTP_200_OK)
except Exception as e:
logger.exception(e)
# delete user
@staticmethod
def delete_user_details(email):
db_user_data = obj_mongo_user.fetch_one_user_details(email)
# if the user is not available
if db_user_data is None:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_EMAIL_ID_DOESNT_EXIST).dict(),
status_code=status.HTTP_404_NOT_FOUND)
filter_data_updated = {"email": email}
response = obj_mongo_user.delete_user(filter_data_updated)
if not response:
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.ERROR_IN_UPDATING).dict(),
status_code=status.HTTP_404_NOT_FOUND)
return JSONResponse(
content=DefaultResponse(status="success", message="Deleted Successfully",
data=filter_data_updated).dict(),
status_code=status.HTTP_200_OK)
@staticmethod @staticmethod
def fetch_user_details(): def fetch_user_details():
cursor_data = MongoUser().fetch_all_user_details() try:
list_user_data = [] filter_data = {'_id': 0,
for users in cursor_data: "login_type": 0,
list_user_data.append(users) "is_alive": 0,
return list_user_data "password": 0,
"created_at": 0,
"updated_at": 0}
cursor_data = obj_mongo_user.fetch_all_user_details({}, filter_data)
cursor_data_count = cursor_data.explain()
if cursor_data_count["executionStats"]["nReturned"] <= 0:
return None
list_user_data = []
for users in cursor_data:
list_user_data.append(users)
return JSONResponse(
content=DefaultResponse(status="success", message="Fetched Successfully",
data=list_user_data).dict(),
status_code=status.HTTP_200_OK)
except Exception as e:
logger.exception(e)
...@@ -33,13 +33,8 @@ class MongoUser(CollectionBaseClass): ...@@ -33,13 +33,8 @@ class MongoUser(CollectionBaseClass):
return user return user
return None return None
def fetch_all_user_details(self): def fetch_all_user_details(self, query, filter_data):
if user := self.find(query={}, filter_dict={'_id': 0, if user := self.find(query=query, filter_dict=filter_data):
"login_type": 0,
"is_alive": 0,
"password": 0,
"created_at": 0,
"updated_at": 0}):
return user return user
return None return None
...@@ -49,7 +44,13 @@ class MongoUser(CollectionBaseClass): ...@@ -49,7 +44,13 @@ class MongoUser(CollectionBaseClass):
return None return None
# updating the login time # updating the login time
def update_user(self, update, query): def update_user(self, query, update):
if user := self.update_one(query=update, data=query): if user := self.update_one(query=query, data=update):
return user
return None
# deleting users
def delete_user(self, query):
if user := self.delete_one(query=query):
return user return user
return None return None
...@@ -8,10 +8,12 @@ class ErrorMessages: ...@@ -8,10 +8,12 @@ class ErrorMessages:
ERROR_UNAUTHORIZED_ACCESS = "Your are not authorized to view this page" ERROR_UNAUTHORIZED_ACCESS = "Your are not authorized to view this page"
ERROR_LOGIN_TYPE_INVALID = "Invalid Login Method" ERROR_LOGIN_TYPE_INVALID = "Invalid Login Method"
ERROR_USER_NOT_REGISTERED = "Account is not registered in the portal." ERROR_USER_NOT_REGISTERED = "Account is not registered in the portal."
ERROR_PASSWORD_MISMATCH = "Passwords Authentication Failed. Please enter the correct password" ERROR_PASSWORD_MISMATCH = "Please enter the correct password"
ERROR_TOKEN_GENERATION = "Unsuccessful token generation" ERROR_TOKEN_GENERATION = "Unsuccessful token generation"
ERROR_STORING_DATA = "New user registration failed" ERROR_STORING_DATA = "New user registration failed"
ERROR_EMAIL_EXIST = "Email Id exists" ERROR_EMAIL_EXIST = "Email Id exists"
ERROR_IN_FETCHING = "Details cannot be fetched"
ERROR_IN_UPDATING = "Error in Updating"
# Data Validation # Data Validation
ERROR_INVALID_PASSWORD = "Invalid Password" ERROR_INVALID_PASSWORD = "Invalid Password"
...@@ -19,3 +21,4 @@ class ErrorMessages: ...@@ -19,3 +21,4 @@ class ErrorMessages:
ERROR_INVALID_EMAIL = "Invalid Email Id" ERROR_INVALID_EMAIL = "Invalid Email Id"
ERROR_INVALID_PHONE_NUMBER = "Invalid Phone Number" ERROR_INVALID_PHONE_NUMBER = "Invalid Phone Number"
ERROR_INVALID_USER_ROLE = "Invalid User Role" ERROR_INVALID_USER_ROLE = "Invalid User Role"
ERROR_EMAIL_ID_DOESNT_EXIST = "Email Id doesn't exist"
...@@ -1372,3 +1372,1252 @@ SyntaxError: invalid syntax ...@@ -1372,3 +1372,1252 @@ SyntaxError: invalid syntax
2023-03-24 19:22:39 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671 2023-03-24 19:22:39 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-24 19:22:49 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671 2023-03-24 19:22:49 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-24 19:23:18 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671 2023-03-24 19:23:18 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 09:37:27 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 09:53:33 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 09:53:36 - ERROR - [MainThread:user_register(): 124] - 'Cursor' object has no attribute 'count'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 70, in fetch_user_details
if cursor_data.count() < 1:
AttributeError: 'Cursor' object has no attribute 'count'
2023-03-27 09:59:08 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 09:59:11 - ERROR - [MainThread:user_register(): 124] - 'MongoUser' object has no attribute 'count_documents'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 70, in fetch_user_details
cursor_data_count = MongoUser().count_documents(cursor_data)
AttributeError: 'MongoUser' object has no attribute 'count_documents'
2023-03-27 10:09:41 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:09:52 - ERROR - [MainThread:user_register(): 124] - 'Cursor' object has no attribute 'count_documents'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 70, in fetch_user_details
cursor_data_count = cursor_data.count_documents({})
AttributeError: 'Cursor' object has no attribute 'count_documents'
2023-03-27 10:12:50 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:12:53 - ERROR - [MainThread:user_register(): 124] - 'Cursor' object has no attribute 'count_documents'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 70, in fetch_user_details
cursor_data_count = cursor_data.count_documents({})
AttributeError: 'Cursor' object has no attribute 'count_documents'
2023-03-27 10:14:21 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:14:23 - ERROR - [MainThread:user_register(): 124] - 'Cursor' object has no attribute 'count'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 71, in fetch_user_details
cursor_data_count = cursor_data.count()
AttributeError: 'Cursor' object has no attribute 'count'
2023-03-27 10:19:39 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:19:43 - ERROR - [MainThread:user_register(): 124] - 'dict' object has no attribute 'count'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 71, in fetch_user_details
cursor_data_count = cursor_data.count()
AttributeError: 'dict' object has no attribute 'count'
2023-03-27 10:20:38 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:20:40 - ERROR - [MainThread:user_register(): 124] - 'dict' object has no attribute 'count'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 118, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 71, in fetch_user_details
cursor_data_count = cursor_data.count()
AttributeError: 'dict' object has no attribute 'count'
2023-03-27 10:24:21 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:24:43 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:25:04 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:25:42 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:26:00 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:26:20 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:26:48 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:27:07 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:27:19 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:27:42 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:28:28 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:29:25 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:45:47 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:45:54 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 37, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 10:53:55 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:56:10 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:56:13 - ERROR - [MainThread:data_validation(): 33] - 'UserUpdate' object has no attribute 'email'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 17, in data_validation
if user_data.email == "" or validate_email(
AttributeError: 'UserUpdate' object has no attribute 'email'
2023-03-27 10:56:13 - ERROR - [MainThread:update_user_details(): 71] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 66, in update_user_details
response, message = UserDataValidations.data_validation(update_data, 'normal', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-27 10:57:19 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 10:57:25 - ERROR - [MainThread:data_validation(): 33] - 'UserUpdate' object has no attribute 'email'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 17, in data_validation
if method != "update" and user_data.email == "" or validate_email(
AttributeError: 'UserUpdate' object has no attribute 'email'
2023-03-27 10:57:25 - ERROR - [MainThread:update_user_details(): 71] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 66, in update_user_details
response, message = UserDataValidations.data_validation(update_data, 'normal', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-27 10:59:12 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:00:19 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:00:35 - ERROR - [MainThread:data_validation(): 33] - 'UserUpdate' object has no attribute 'email'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 17, in data_validation
if method != "update" and (user_data.email == "" or validate_email(
AttributeError: 'UserUpdate' object has no attribute 'email'
2023-03-27 11:00:35 - ERROR - [MainThread:update_user_details(): 71] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 66, in update_user_details
response, message = UserDataValidations.data_validation(update_data, 'normal', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-27 11:04:54 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:05:01 - ERROR - [MainThread:data_validation(): 33] - 'UserUpdate' object has no attribute 'email'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\validations_util.py", line 19, in data_validation
return False, {"message": ErrorMessages.ERROR_INVALID_EMAIL, "data": user_data.email}
AttributeError: 'UserUpdate' object has no attribute 'email'
2023-03-27 11:05:01 - ERROR - [MainThread:update_user_details(): 71] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 66, in update_user_details
response, message = UserDataValidations.data_validation(update_data, 'normal', self.method)
TypeError: cannot unpack non-iterable NoneType object
2023-03-27 11:06:54 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:06:57 - ERROR - [MainThread:update_one(): 147] - Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 782, in _update
_check_write_command_response(result)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 217, in _check_write_command_response
_raise_last_write_error(write_errors)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 190, in _raise_last_write_error
raise WriteError(error.get("errmsg"), error.get("code"), error)
pymongo.errors.WriteError: Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}'}
2023-03-27 11:06:57 - ERROR - [MainThread:update_user_details(): 71] - Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 69, in update_user_details
obj_mongo_user.update_user(update_data_removed, filter_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 782, in _update
_check_write_command_response(result)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 217, in _check_write_command_response
_raise_last_write_error(write_errors)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 190, in _raise_last_write_error
raise WriteError(error.get("errmsg"), error.get("code"), error)
pymongo.errors.WriteError: Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowlegelens.com"}'}
2023-03-27 11:07:56 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:08:43 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:09:36 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:10:05 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:11:28 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:11:32 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:11:32 - ERROR - [MainThread:update_user_details(): 74] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 71, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:14:26 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:14:40 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:14:40 - ERROR - [MainThread:update_user_details(): 79] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 76, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:21:31 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:21:31 - ERROR - [MainThread:<module>(): 41] - expected an indented block (iot_manager_services.py, line 92)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 39, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 92
except Exception as e:
IndentationError: expected an indented block
2023-03-27 11:21:55 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:22:01 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 37, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 11:22:20 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 37, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 11:23:53 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:23:57 - ERROR - [MainThread:generate_cookie_tokens(): 84] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 74, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 37, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 11:26:35 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:26:39 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 37, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 11:26:54 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:26:58 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'MongoUser' object has no attribute 'update_login_time'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 73, in generate_cookie_tokens
access_token = create_token(
File "E:\Git\meta-services\scripts\utils\security\apply_encrytion_util.py", line 36, in create_token
mongo_user.update_login_time({"email": user_id}, {"updated_at": current_time})
AttributeError: 'MongoUser' object has no attribute 'update_login_time'
2023-03-27 11:27:16 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:27:25 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:27:25 - ERROR - [MainThread:update_user_details(): 82] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:28:16 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:28:22 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:28:33 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:28:38 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:28:38 - ERROR - [MainThread:update_user_details(): 83] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 80, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:28:48 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:29:05 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:29:27 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:29:45 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:30:10 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:30:46 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:30:46 - ERROR - [MainThread:update_user_details(): 82] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:31:15 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:31:21 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:31:21 - ERROR - [MainThread:update_user_details(): 83] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 80, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=update, data=query):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:32:26 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:32:29 - ERROR - [MainThread:update_one(): 147] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:32:29 - ERROR - [MainThread:update_user_details(): 82] - cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=query, data=update):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one(query, {strategy: data}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 773, in _update
result = sock_info.command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 795, in command
self._raise_connection_failure(error)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\pool.py", line 767, in command
return command(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\network.py", line 127, in command
request_id, msg, size, max_doc_size = message._op_msg(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\message.py", line 692, in _op_msg
return _op_msg_uncompressed(flags, command, identifier, docs, opts)
bson.errors.InvalidDocument: cannot encode object: UserUpdate(name='Amal', user_role=None), of type: <class 'scripts.schemas.project_schema.UserUpdate'>
2023-03-27 11:34:23 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:34:28 - ERROR - [MainThread:update_one(): 147] - Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one({"name": "Amal"}, {strategy: "ajil.k@knowledgelens.com"}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 782, in _update
_check_write_command_response(result)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 217, in _check_write_command_response
_raise_last_write_error(write_errors)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 190, in _raise_last_write_error
raise WriteError(error.get("errmsg"), error.get("code"), error)
pymongo.errors.WriteError: Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}'}
2023-03-27 11:34:28 - ERROR - [MainThread:update_user_details(): 82] - Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}'}
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 79, in update_user_details
user = obj_mongo_user.update_user(filter_data_updated, update_data)
File "E:\Git\meta-services\scripts\database\mongo\mongo_db.py", line 48, in update_user
if user := self.update_one(query=query, data=update):
File "E:\Git\meta-services\scripts\utils\mongo_tools\mongo_sync.py", line 145, in update_one
return collection.update_one({"name": "Amal"}, {strategy: "ajil.k@knowledgelens.com"}, upsert=upsert)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 1041, in update_one
self._update_retryable(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 836, in _update_retryable
return self.__database.client._retryable_write(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\mongo_client.py", line 1390, in _retry_internal
return func(session, sock_info, retryable)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 817, in _update
return self._update(
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\collection.py", line 782, in _update
_check_write_command_response(result)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 217, in _check_write_command_response
_raise_last_write_error(write_errors)
File "E:\Git\meta-services\venv\lib\site-packages\pymongo\helpers.py", line 190, in _raise_last_write_error
raise WriteError(error.get("errmsg"), error.get("code"), error)
pymongo.errors.WriteError: Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}, full error: {'index': 0, 'code': 9, 'errmsg': 'Modifiers operate on fields but we found type string instead. For example: {$mod: {<field>: ...}} not {$set: "ajil.k@knowledgelens.com"}'}
2023-03-27 11:35:44 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:36:13 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:37:33 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:39:54 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:46:42 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:46:46 - ERROR - [MainThread:update_user_details(): 90] - unhashable type: 'dict'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 87, in update_user_details
data={update_data_removed}).dict(),
TypeError: unhashable type: 'dict'
2023-03-27 11:47:21 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:50:05 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 11:58:13 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 12:06:01 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 12:06:02 - ERROR - [MainThread:<module>(): 41] - invalid syntax (user_management_handler.py, line 94)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 39, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.user_management_handler import UserManagement
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94
def
^
SyntaxError: invalid syntax
2023-03-27 12:06:23 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 12:06:23 - ERROR - [MainThread:<module>(): 41] - invalid syntax (user_management_handler.py, line 94)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 39, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.user_management_handler import UserManagement
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94
def
^
SyntaxError: invalid syntax
2023-03-27 12:06:33 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 12:06:33 - ERROR - [MainThread:<module>(): 41] - invalid syntax (user_management_handler.py, line 94)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 39, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.user_management_handler import UserManagement
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94
def
^
SyntaxError: invalid syntax
2023-03-27 12:06:36 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 12:06:36 - ERROR - [MainThread:<module>(): 41] - invalid syntax (user_management_handler.py, line 94)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 39, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.user_management_handler import UserManagement
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 94
def
^
SyntaxError: invalid syntax
2023-03-27 12:07:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:12:32 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:12:36 - ERROR - [MainThread:generate_cookie_tokens(): 83] - 'Request' object has no attribute 'ip_address'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 75, in generate_cookie_tokens
ip=request.ip_address
AttributeError: 'Request' object has no attribute 'ip_address'
2023-03-27 14:13:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:13:34 - ERROR - [MainThread:generate_cookie_tokens(): 84] - 'Request' object has no attribute 'ip_address'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 76, in generate_cookie_tokens
ip=request.ip_address
AttributeError: 'Request' object has no attribute 'ip_address'
2023-03-27 14:13:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:13:48 - ERROR - [MainThread:generate_cookie_tokens(): 84] - 'Request' object has no attribute 'ip_address'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\normal_login.py", line 72, in generate_cookie_tokens
print(request.ip_address)
AttributeError: 'Request' object has no attribute 'ip_address'
2023-03-27 14:15:58 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:28:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:32:05 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:32:08 - ERROR - [MainThread:login_default(): 43] - 'dict' object has no attribute 'set_cookie'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 36, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 46, in normal_login
response.set_cookie(key="login-token", value=response)
AttributeError: 'dict' object has no attribute 'set_cookie'
2023-03-27 14:34:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:34:38 - ERROR - [MainThread:login_default(): 43] - 'Request' object has no attribute 'set_cookie'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 36, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 46, in normal_login
request.set_cookie(key="login-token", value=response)
AttributeError: 'Request' object has no attribute 'set_cookie'
2023-03-27 14:35:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:35:54 - ERROR - [MainThread:login_default(): 43] - set_cookie() missing 1 required positional argument: 'self'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 36, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 48, in normal_login
fastapi.Response.set_cookie(key="login-token", value=response)
TypeError: set_cookie() missing 1 required positional argument: 'self'
2023-03-27 14:39:12 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:39:16 - ERROR - [MainThread:login_default(): 43] - set_cookie() missing 1 required positional argument: 'self'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 36, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 49, in normal_login
response.set_cookie(key="login-token", value=responses, expires=exp)
TypeError: set_cookie() missing 1 required positional argument: 'self'
2023-03-27 14:42:33 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:43:44 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:45:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:45:20 - ERROR - [MainThread:login_default(): 44] - usegmt option requires a UTC datetime
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request, response)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 49, in normal_login
response.set_cookie(key="login-token", value=responses, expires=exp)
File "E:\Git\meta-services\venv\lib\site-packages\starlette\responses.py", line 122, in set_cookie
cookie[key]["expires"] = format_datetime(expires, usegmt=True)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\email\utils.py", line 165, in format_datetime
raise ValueError("usegmt option requires a UTC datetime")
ValueError: usegmt option requires a UTC datetime
2023-03-27 14:49:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:52:40 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 14:53:40 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 14:56:37 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 14:56:59 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 14:58:36 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 15:00:55 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 15:02:17 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 15:03:39 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 15:04:05 - ERROR - [MainThread:user_register(): 132] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 120, in user_register
response = AuthorizeAccess().admin_authorize(request)
File "E:\Git\meta-services\scripts\utils\security\authorize_access.py", line 10, in admin_authorize
if user_data["user_role"] != "super admin":
TypeError: 'NoneType' object is not subscriptable
2023-03-27 15:05:07 - INFO - [MainThread:<module>(): 37] - App Starting at 127.0.0.1:8671
2023-03-27 15:05:15 - ERROR - [MainThread:user_register(): 132] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 120, in user_register
response = AuthorizeAccess().admin_authorize(request)
File "E:\Git\meta-services\scripts\utils\security\authorize_access.py", line 10, in admin_authorize
if user_data["user_role"] != "super admin":
TypeError: 'NoneType' object is not subscriptable
2023-03-27 15:08:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:10:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:12:02 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:12:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:13:46 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:17:11 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:19:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:20:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:22:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:24:12 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:24:32 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:25:03 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:26:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:28:41 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:31:59 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:34:29 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:35:49 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:43:07 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:43:11 - ERROR - [MainThread:login_default(): 44] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request, response)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 24, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 15:43:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:43:58 - ERROR - [MainThread:login_default(): 44] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request, response)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 15:50:08 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:53:05 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 15:54:16 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:00:09 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:02:22 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:02:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:04:02 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:06:29 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:09:13 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:19:01 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:20:14 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:20:17 - ERROR - [MainThread:login_default(): 44] - normal_login() takes 3 positional arguments but 4 were given
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request, response)
TypeError: normal_login() takes 3 positional arguments but 4 were given
2023-03-27 16:21:45 - ERROR - [MainThread:login_default(): 44] - normal_login() takes 3 positional arguments but 4 were given
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request, response)
TypeError: normal_login() takes 3 positional arguments but 4 were given
2023-03-27 16:22:04 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:22:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:23:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:23:46 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:24:20 - ERROR - [MainThread:user_register(): 133] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 121, in user_register
response = AuthorizeAccess().admin_authorize(request)
File "E:\Git\meta-services\scripts\utils\security\authorize_access.py", line 10, in admin_authorize
if user_data["user_role"] != "super admin":
TypeError: 'NoneType' object is not subscriptable
2023-03-27 16:25:36 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:25:38 - ERROR - [MainThread:user_register(): 133] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 121, in user_register
response = AuthorizeAccess().admin_authorize(request)
File "E:\Git\meta-services\scripts\utils\security\authorize_access.py", line 11, in admin_authorize
if user_data["user_role"] != "super admin":
TypeError: 'NoneType' object is not subscriptable
2023-03-27 16:26:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:26:38 - ERROR - [MainThread:user_register(): 133] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 121, in user_register
response = AuthorizeAccess().admin_authorize(request)
File "E:\Git\meta-services\scripts\utils\security\authorize_access.py", line 11, in admin_authorize
if user_data["user_role"] != "super admin":
TypeError: 'NoneType' object is not subscriptable
2023-03-27 16:26:45 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:26:48 - ERROR - [MainThread:user_register(): 133] - 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 126, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 132, in fetch_user_details
content=DefaultResponse(message="Fetching Successful", data=list_user_data).dict(),
File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
2023-03-27 16:26:56 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:27:06 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:27:09 - ERROR - [MainThread:user_register(): 133] - 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 126, in user_register
response = obj_user_handler.fetch_user_details()
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 132, in fetch_user_details
content=DefaultResponse(message="Fetching Successful", data=list_user_data).dict(),
File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
2023-03-27 16:29:49 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:31:43 - ERROR - [MainThread:login_default(): 44] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 16:36:04 - ERROR - [MainThread:login_default(): 44] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 16:39:10 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:39:13 - ERROR - [MainThread:login_default(): 44] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 37, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 16:43:04 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:43:07 - ERROR - [MainThread:login_default(): 45] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 38, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 16:45:32 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:46:22 - ERROR - [MainThread:login_default(): 45] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 38, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 16:47:13 - ERROR - [MainThread:update_user_details(): 90] - 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\user_management_handler.py", line 86, in update_user_details
content=DefaultResponse(message="Update Successful",
File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for DefaultResponse
status
field required (type=value_error.missing)
2023-03-27 16:51:33 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 16:59:12 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:01:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:01:50 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:02:17 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:02:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:03:22 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:05:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:08:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:10:39 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:11:34 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:12:00 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:12:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:14:04 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:14:12 - ERROR - [MainThread:login_default(): 45] - list index out of range
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 38, in login_default
return login_mapper[login_type](user_data, request)
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 25, in normal_login
decrypted_password.split("\"")[1])
IndexError: list index out of range
2023-03-27 17:15:02 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:16:23 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:16:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:33:42 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 17:48:14 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 18:23:48 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 18:24:35 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 18:28:40 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 18:35:41 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 18:48:55 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:17:55 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:19:31 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:43:24 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:43:46 - ERROR - [MainThread:dashboard_download(): 177] - unhashable type: 'dict'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 170, in dashboard_download
response = obj_dashboard_handler.download_header()
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in download_header
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in <setcomp>
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
TypeError: unhashable type: 'dict'
2023-03-27 19:44:20 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:44:23 - ERROR - [MainThread:dashboard_download(): 177] - unhashable type: 'dict'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 170, in dashboard_download
response = obj_dashboard_handler.download_header()
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in download_header
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in <setcomp>
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
TypeError: unhashable type: 'dict'
2023-03-27 19:44:38 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:44:43 - ERROR - [MainThread:dashboard_download(): 177] - unhashable type: 'dict'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 170, in dashboard_download
response = obj_dashboard_handler.download_header()
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in download_header
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 50, in <setcomp>
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
TypeError: unhashable type: 'dict'
2023-03-27 19:44:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-27 19:44:54 - ERROR - [MainThread:dashboard_download(): 177] - unhashable type: 'dict'
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 170, in dashboard_download
response = obj_dashboard_handler.download_header()
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 51, in download_header
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
File "E:\Git\meta-services\scripts\core\handlers\dashboard_handler.py", line 51, in <setcomp>
column_values = {{"header_name": key, "field": key, "key": "file_name"} for key in self.download_files}
TypeError: unhashable type: 'dict'
...@@ -5,12 +5,12 @@ from pydantic import BaseModel ...@@ -5,12 +5,12 @@ from pydantic import BaseModel
# default responses # default responses
class DefaultResponse(BaseModel): class DefaultResponse(BaseModel):
status: bool = True status: str
message: Optional[str] message: str
data: Optional[Any] data: Optional[Any]
# default failure responses # default failure responses
class DefaultFailureResponse(DefaultResponse): class DefaultFailureResponse(BaseModel):
status: bool = False status: str
error: Any message: Any
...@@ -16,3 +16,10 @@ class RegistrationData(BaseModel): ...@@ -16,3 +16,10 @@ class RegistrationData(BaseModel):
phone_number: Optional[str] phone_number: Optional[str]
login_type: str login_type: str
user_role: str user_role: str
class UserUpdate(BaseModel):
name: Optional[str] = None
email: Optional[str] = None
phone_number: Optional[str] = None
user_role: Optional[str] = None
from fastapi import APIRouter, HTTPException, status, Depends from fastapi import APIRouter, HTTPException, status, Depends, Request
from fastapi.responses import JSONResponse
from scripts.constants.api import ApiEndPoints from scripts.constants.api import ApiEndPoints
from scripts.core.handlers.dashboard_handler import DashboardManagement
from scripts.core.handlers.login_handler import LoginHandlers from scripts.core.handlers.login_handler import LoginHandlers
from scripts.core.handlers.user_management_handler import UserManagement from scripts.core.handlers.user_management_handler import UserManagement
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from scripts.schemas.project_schema import LoginRequest, RegistrationData from scripts.schemas.default_responses import DefaultFailureResponse
from scripts.schemas.project_schema import LoginRequest, RegistrationData, UserUpdate
from scripts.utils.security.authorize_access import AuthorizeAccess from scripts.utils.security.authorize_access import AuthorizeAccess
from scripts.utils.security.decorators import MetaInfoSchema, auth from scripts.utils.security.decorators import MetaInfoSchema, auth
...@@ -14,6 +17,7 @@ router = APIRouter(prefix=ApiEndPoints.version) ...@@ -14,6 +17,7 @@ router = APIRouter(prefix=ApiEndPoints.version)
# initializing the handler # initializing the handler
obj_login_handler = LoginHandlers() obj_login_handler = LoginHandlers()
obj_user_handler = UserManagement() obj_user_handler = UserManagement()
obj_dashboard_handler = DashboardManagement()
# login API # login API
...@@ -21,7 +25,7 @@ obj_user_handler = UserManagement() ...@@ -21,7 +25,7 @@ obj_user_handler = UserManagement()
async def login_default( async def login_default(
login_type: str, login_type: str,
user_data: LoginRequest, user_data: LoginRequest,
request: MetaInfoSchema = Depends(auth) request: Request,
): ):
try: try:
# mapper for login types # mapper for login types
...@@ -41,6 +45,10 @@ async def login_default( ...@@ -41,6 +45,10 @@ async def login_default(
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# Create new users API # Create new users API
...@@ -72,11 +80,17 @@ async def user_register( ...@@ -72,11 +80,17 @@ async def user_register(
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# Update users API # Update users API
@router.post(ApiEndPoints.asset_manager_user_update) @router.post(ApiEndPoints.asset_manager_user_update)
async def user_register( async def user_register(
email: str,
update_data: UserUpdate,
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
...@@ -85,13 +99,20 @@ async def user_register( ...@@ -85,13 +99,20 @@ async def user_register(
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS) detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS)
response = obj_user_handler.update_user_details(email, update_data)
return response
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# Delete users API # Delete users API
@router.post(ApiEndPoints.asset_manager_user_delete) @router.post(ApiEndPoints.asset_manager_user_delete)
async def user_register( async def user_register(
email: str,
request: MetaInfoSchema = Depends(auth) request: MetaInfoSchema = Depends(auth)
): ):
try: try:
...@@ -100,8 +121,14 @@ async def user_register( ...@@ -100,8 +121,14 @@ async def user_register(
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS) detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS)
response = obj_user_handler.delete_user_details(email)
return response
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# View users API # View users API
...@@ -115,6 +142,65 @@ async def user_register( ...@@ -115,6 +142,65 @@ async def user_register(
return HTTPException( return HTTPException(
status_code=status.HTTP_403_FORBIDDEN, status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS) detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS)
return obj_user_handler.fetch_user_details() response = obj_user_handler.fetch_user_details()
if not response:
return HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_IN_FETCHING)
return response
except Exception as e:
logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# download Button Dashboard header
@router.post(ApiEndPoints.asset_manager_dashboard_download_header)
async def dashboard_download(
request: MetaInfoSchema = Depends(auth)
):
try:
response = AuthorizeAccess().admin_authorize(request)
if not response:
return HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS)
response = obj_dashboard_handler.download_header()
if not response:
return HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_IN_FETCHING)
return response
except Exception as e:
logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
# download Button Dashboard
@router.post(ApiEndPoints.asset_manager_dashboard_download)
async def dashboard_download(
request: MetaInfoSchema = Depends(auth)
):
try:
response = AuthorizeAccess().admin_authorize(request)
if not response:
return HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_UNAUTHORIZED_ACCESS)
response = obj_dashboard_handler.download_details()
if not response:
return HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ErrorMessages.ERROR_IN_FETCHING)
return response
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
return JSONResponse(
content=DefaultFailureResponse(status="failed",
message=ErrorMessages.OP_FAILED).dict(),
status_code=status.HTTP_200_OK)
...@@ -35,4 +35,14 @@ class RegexValidation: ...@@ -35,4 +35,14 @@ class RegexValidation:
if re.fullmatch(regex, email): if re.fullmatch(regex, email):
return regex return regex
except Exception as e: except Exception as e:
logger.error(f'An Error While listing the home plans {str(e)}') logger.error(f'An Error While listing the home plans {str(e)}')
\ No newline at end of file
@staticmethod
def password_validation(password):
try:
password_regex = r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+={}[\]:;\"\'|,.<>\/?]).{8,15}$'
if re.search(password_regex, password):
return False
except Exception as e:
logger.error(f'An Error While listing the home plans {str(e)}')
from datetime import datetime, timedelta import uuid
from datetime import datetime, timedelta, timezone
from scripts.config import Secrets from scripts.config import Secrets
from scripts.database.mongo.mongo_db import MongoUser from scripts.database.mongo.mongo_db import MongoUser
...@@ -12,15 +13,19 @@ mongo_user = MongoUser() ...@@ -12,15 +13,19 @@ mongo_user = MongoUser()
def create_token( def create_token(
user_id, user_id,
ip, ip,
login_token=None,
age=Secrets.ACCESS_TOKEN_EXPIRE_MINUTES, age=Secrets.ACCESS_TOKEN_EXPIRE_MINUTES,
): ):
""" """
This method is to create a cookie This method is to create a cookie
""" """
uid = login_token
if not uid:
uid = str(uuid.uuid4()).replace("-", "")
# creating the payload # creating the payload
payload = {"ip": ip, "user_id": user_id, "token": Secrets.SECRET_KEY, "age": age} payload = {"ip": ip, "user_id": user_id, "token": Secrets.SECRET_KEY, "uid": uid, "age": age}
# getting the current time # getting the current time
current_time = datetime.now() current_time = datetime.now(timezone.utc)
# generating the expiry time of the token # generating the expiry time of the token
exp = current_time + timedelta(minutes=age) exp = current_time + timedelta(minutes=age)
# creating the dictionary with issuer and expiry time # creating the dictionary with issuer and expiry time
...@@ -30,10 +35,8 @@ def create_token( ...@@ -30,10 +35,8 @@ def create_token(
new_token = jwt.encode(_payload) new_token = jwt.encode(_payload)
# Add session to redis # Add session to redis
login_db.set(user_id, new_token) login_db.set(uid, new_token)
login_db.expire(user_id, timedelta(minutes=age)) login_db.expire(uid, timedelta(minutes=age))
# Add updated time to mongo db # Add updated time to mongo db
mongo_user.update_user({"email": user_id}, {"updated_at": current_time}) mongo_user.update_user({"email": user_id}, {"updated_at": current_time})
return uid, exp
return user_id
...@@ -6,7 +6,7 @@ obj_mongo_user = MongoUser() ...@@ -6,7 +6,7 @@ obj_mongo_user = MongoUser()
class AuthorizeAccess: class AuthorizeAccess:
@staticmethod @staticmethod
def admin_authorize(request): def admin_authorize(request):
user_data = obj_mongo_user.fetch_one_user_details(request.login_token) user_data = obj_mongo_user.fetch_one_user_details(request.user_id)
if user_data["user_role"] != "super admin": if user_data["user_role"] != "super admin":
return False return False
return True return True
...@@ -4,7 +4,6 @@ from fastapi.security import APIKeyCookie ...@@ -4,7 +4,6 @@ from fastapi.security import APIKeyCookie
from fastapi.security.api_key import APIKeyBase from fastapi.security.api_key import APIKeyBase
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from scripts.config import Services
from scripts.database.redis.redis_conn import login_db from scripts.database.redis.redis_conn import login_db
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
...@@ -50,16 +49,8 @@ class _CookieAuthentication(APIKeyBase): ...@@ -50,16 +49,8 @@ class _CookieAuthentication(APIKeyBase):
login_token = cookies.get(self.cookie_name) or request.headers.get( login_token = cookies.get(self.cookie_name) or request.headers.get(
self.cookie_name self.cookie_name
) )
if not login_token or login_token != Services.PROJECT_NAME: if not login_token:
if not login_token: raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)
# if the cookie name is same as the service name
if login_token == Services.PROJECT_NAME:
return MetaInfoSchema(
ip_address=request.client.host, # type: ignore
login_token=cookies.get("login-token"),
)
# getting the token stored in redis based on the cookie value
jwt_token = self.login_redis.get(login_token) jwt_token = self.login_redis.get(login_token)
if not jwt_token: if not jwt_token:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED) raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)
...@@ -83,7 +74,6 @@ class _CookieAuthentication(APIKeyBase): ...@@ -83,7 +74,6 @@ class _CookieAuthentication(APIKeyBase):
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Token doesn't have required fields", detail="Token doesn't have required fields",
) )
return MetaInfoSchema( return MetaInfoSchema(
user_id=user_id, user_id=user_id,
ip_address=request.client.host, # type: ignore ip_address=request.client.host, # type: ignore
......
...@@ -8,7 +8,7 @@ from scripts.logging.logger import logger ...@@ -8,7 +8,7 @@ from scripts.logging.logger import logger
class UserDataValidations: class UserDataValidations:
@staticmethod @staticmethod
def data_validation(user_data, method, feature): def register_data_validation(user_data, method, feature):
try: try:
if user_data.name == "": if user_data.name == "":
return False, {"message": ErrorMessages.ERROR_INVALID_NAME, return False, {"message": ErrorMessages.ERROR_INVALID_NAME,
...@@ -31,3 +31,16 @@ class UserDataValidations: ...@@ -31,3 +31,16 @@ class UserDataValidations:
return True, None return True, None
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
@staticmethod
def update_data_validation(user_data):
try:
if user_data.name == "":
return False, {"message": ErrorMessages.ERROR_INVALID_NAME,
"data": user_data.phone_number}
if user_data.user_role == "":
return False, {"message": ErrorMessages.ERROR_INVALID_USER_ROLE,
"data": user_data.phone_number}
return True, None
except Exception as e:
logger.exception(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