Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
LOGYCA public libraries
Source code | Package (PyPI) | Samples | Unit tests
The user must select the required libraries and versions for the project that uses this library, which validates that they are pre-installed in order to be installed.
To install the libraries of the logyca package (APIResult,Health) verifying the pydantic,pytz prerequisite without validating other packages, use the following command:
# Check pydantic dependency that is installed
pip install logyca
To install the fastapi package libraries and logyca authentication dependency injection, use the following command:
# Check the aiohttp dependency that is installed, for use with oauth authentication, e.g. single sign-on (SSO).
pip install logyca[oauth_token]
# Check the fastapi dependency that is installed, for use with Api-key authentication.
pip install logyca[api_key_simple_auth]
# Check the fastapi dependency that is installed, for use with Api-key and oauth authentication.
pip install logyca[oauth_token-api_key_simple_auth]
logyca < MAJOR >.< MINOR >.< PATCH >
https://peps.python.org/pep-0440/
# Windows
python -m pip install logyca
# Linux
pip install logyca
# 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
}
{
"dataError":false,
"resultObject":null,
"resultToken":"Not Null"
}
{
"dataError":false,
"resultObject"="Not Null"
"resultToken"=null
}
{
"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"
from fastapi.encoders import jsonable_encoder
from logyca import HealthEnum, LogycaStatusEnum, APIResultDTO, ApiFilterExceptionDTO, HTTPExceptionDTO, HealthDTO, TokensDTO
from starlette.responses import JSONResponse
import json
def example_service():
tokensDTO=TokensDTO()
tokensDTO.token='Token Example'
apiFilterExceptionDTO=ApiFilterExceptionDTO()
apiFilterExceptionDTO.isError=False
apiFilterExceptionDTO.logycaStatus=int(LogycaStatusEnum.Already_Exists)
apiFilterExceptionDTO.status=int(LogycaStatusEnum.Already_Exists.mappingHttpStatusCode)
httpExceptionDTO=HTTPExceptionDTO()
httpExceptionDTO.detail='No Problem'
listHealth=[]
listHealth.append(HealthDTO(name='Check CPU',status=HealthEnum.Ok,description='OK').__dict__)
listHealth.append(HealthDTO(name='Check Connect DB',status=HealthEnum.Warning,description='Warning').__dict__)
listHealth.append(HealthDTO(name='Check Connect Storage',status=HealthEnum.Critical,description='Critical').__dict__)
apiResultDTO=APIResultDTO()
apiResultDTO.resultMessage=httpExceptionDTO.detail
apiResultDTO.resultObject=listHealth
apiResultDTO.dataError=False
apiResultDTO.resultToken=tokensDTO
apiResultDTO.apiException=apiFilterExceptionDTO
return apiResultDTO
def simulator_api_return():
apiResultDTO = example_service()
content = jsonable_encoder(apiResultDTO)
print((json.dumps(content,indent=4)))
return JSONResponse(content=content,status_code=200)
simulator_api_return()
# output sample
#
# {
# "resultToken": {
# "token": "Token Example",
# "refreshToken": "",
# "result": "",
# "emailActiveDirectory": "",
# "message": ""
# },
# "resultObject": [
# {
# "name": "Check CPU",
# "status": 0,
# "description": "OK"
# },
# {
# "name": "Check Connect DB",
# "status": 1,
# "description": "Warning"
# },
# {
# "name": "Check Connect Storage",
# "status": 2,
# "description": "Critical"
# }
# ],
# "apiException": {
# "message": "",
# "isError": false,
# "detail": null,
# "status": 409,
# "logycaStatus": 6
# },
# "resultMessage": "No Problem",
# "dataError": false
# }
from logyca import buildUrl,convertDateTimeStampUTCtoUTCColombia
url1='https://domain.com'
url2='api/get'
print(f'buildUrl={buildUrl(url1,url2)}')
# ouput
# buildUrl=https://domain.com/api/get
datetimestampUTC=1679729109
print(f'datetimeUTCColombia={convertDateTimeStampUTCtoUTCColombia(datetimestampUTC)}')
# output
# datetimeUTCColombia=2023-03-25 02:25:09-05:00
At the root of the project, the logs folder is created and the types of errors are differentiated by different files.
# main.py
from logyca import Logger, ConstantsLogger
logger = Logger(logger_name=ConstantsLogger.NAME,log_dir=FOLDER_LOGS,log_file_name=f"{App.Settings.NAME}")
logger.info(f"message")
# Other files.py
from logyca import Logger, ConstantsLogger
import logging
logger = logging.getLogger(ConstantsLogger.NAME)
logger.info(f"message")
logger.error(f"message")
# Library installation
# Windows
python -m pip install logyca[test]
# Linux
pip install logyca
# Run it
pytest -s
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
FAQs
This package name is reserved by LOGYCA company
We found that logyca demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.