Package: logyca
LOGYCA public librariesAbout usLOGYCA CompanyLOGYCA Youtube ChannelWhat's librariesTraversal libraries: Standard methods to be used by microservices.Return codes: Standard methods to report result status codes.Monitoring: Standard methods to report check health status codes.Helpers: Standard methods to be used. *Semantic Versioninglogyca ..MAJOR: version when you make incompatible API changesMINOR: version when you add functionality in a backwards compatible mannerPATCH: version when you make backwards compatible bug fixesQuick install#Windowspython -m pip install logyca#Linuxpip install logycaExample of concepts using library APIResult# Example output from ApiResult:result={"resultToken":{"token":"","refreshToken":"","result":"","emailActiveDirectory":"","message":""},"resultObject":[{"name":"Database server","status":0,"description":"Connection status fine"},{"name":"Redis server","status":0,"description":"Connection status fine"}],"apiException":{"message":"","isError":false,"detail":null,"status":200,"logycaStatus":0},"resultMessage":"","dataError":false}Use cases: you must catch de exceptionif you get data only the token:{"dataError":false,"resultObject":null,"resultToken":"Not Null"}if you get data correctly{"dataError":false,"resultObject"="Not Null""resultToken"=null}if you don't get because the operation was cancelled{"dataError":true,"resultObject":null,"resultToken":null,"apiException.logycaStatus":1,"apiException.status"=404,"resultMessage":"exception messages: the operation was cancelled"}[optional]apiException.message="if needed, return an object with structured failure data other than exception messages"Example of using library APIResult + Health CheckfromlogycaimportHealthEnum,LogycaStatusEnum,APIResultDTO,ApiFilterExceptionDTO,HTTPExceptionDTO,HealthDTO,TokensDTOtokensDTO=TokensDTO()tokensDTO.token='Token Example'apiFilterExceptionDTO=ApiFilterExceptionDTO()apiFilterExceptionDTO.isError=FalseapiFilterExceptionDTO.logycaStatus=LogycaStatusEnum.Already_ExistsapiFilterExceptionDTO.status=LogycaStatusEnum.Already_Exists.mappingHttpStatusCodehttpExceptionDTO=HTTPExceptionDTO()httpExceptionDTO.detail='No Problem'listHealth=[]listHealth.append(HealthDTO(name='Check CPU',status=HealthEnum.Ok,description='OK'))listHealth.append(HealthDTO(name='Check Connect DB',status=HealthEnum.Warning,description='Warning'))listHealth.append(HealthDTO(name='Check Connect Storage',status=HealthEnum.Critical,description='Critical'))apiResultDTO=APIResultDTO()apiResultDTO.resultMessage=httpExceptionDTO.detailapiResultDTO.resultObject=listHealthapiResultDTO.dataError=FalseapiResultDTO.resultToken=tokensDTOapiResultDTO.apiException=apiFilterExceptionDTOprint(apiResultDTO.resultToken)foriteminapiResultDTO.resultObject:print(f'name={item.name},status={item.status},description={item.description}')print(apiResultDTO.resultToken)# output# token='Token Example' refreshToken='' result='' emailActiveDirectory='' message=''# name=Check CPU,status=0,description=OK# name=Check Connect DB,status=1,description=Warning# name=Check Connect Storage,status=2,description=Critical# token='Token Example' refreshToken='' result='' emailActiveDirectory='' message=''Example of using helpersfromlogycaimportbuildUrl,convertDateTimeStampUTCtoUTCColombiaurl1='https://domain.com'url2='api/get'print(f'buildUrl={buildUrl(url1,url2)}')# ouput# buildUrl=https://domain.com/api/getdatetimestampUTC=1679729109print(f'datetimeUTCColombia={convertDateTimeStampUTCtoUTCColombia(datetimestampUTC)}')# output# datetimeUTCColombia=2023-03-25 02:25:09-05:00Current library test#Libraryinstallation#Windowspython -m pip install logyca[test]#Linuxpip install logyca#Runitpytest -sChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog,
and this project adheres toSemantic Versioning.Types of changesAdded for new features.Changed for changes in existing functionality.Deprecated for soon-to-be removed features.Removed for now removed features.Fixed for any bug fixes.Security in case of vulnerabilities.[0.1.8] - 2023-10-03FixedDue to a link error in the readme to internal documents in pypi, we chose to leave the changelog at the end of the readme.[0.1.7] - 2023-10-02FixedThe url address for the logyca logo is correctedAdjust return code for LogycaStatusEnum class: LogycaStatusEnum.Created==HTTPStatus.CREATEDAdjust return code for LogycaStatusEnum class: LogycaStatusEnum.InProcess==HTTPStatus.ACCEPTEDAdjust return code for LogycaStatusEnum class: LogycaStatusEnum.Partial==HTTPStatus.ACCEPTEDEmpty filesinit.py removed[0.1.6] - 2023-09-11FixedPydantic restriction for versions lower than 2.0 is removed[0.1.5] - 2023-03-27AddedRelease ready for production