Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Defelo edited this page Jul 27, 2019 · 3 revisions

Cryptic-Game Python3-Lib

🔥 This guide does not explain how this library works internaly its just a quick guide what features it provides. 🔥

Installation

pip3 install cryptic-game

Enviroment Variables

Variable Functionality
MODE debug or production
DATA_LOCATION Path where you sqlite db should be stored under debug mode
DBMS Mysql or sqlite used internaly
SQLITE_FILE Name of your sqlite db
MYSQL_HOSTNAME Host where your mysql server runs
MYSQL_PORT Under which port your mysql on the given host runs
MYSQL_DATABASE Name of your mysql database
MYSQL_USERNAME Mysql username
MYSQL_PASSWORD Your password for this given user
PATH_LOGFILE Path too where your logging files should be stored
DSN Data Structure Name for your sentry instance
RELEASE The Release this will be reported too sentry

Requirements

See the requirements.txt

Init your Microservice

from cryptic import Microservice

m: Microservice = Microservice("your_ms_name")

# Database wrapper relevant for later
wrapper = m.get_wrapper()

Defining Endpoints

from scheme import Text

m.user_endpoint(path = ["info"], requires = {"user_name": Text()}
def info(data: dict, user: str):
     return {"message": "Hi " + data["user_name"] + " your uuid is " + user}

We can see here multiple things we can define under with path this endpoint is reachable and what requirements it has the python3-lib will automaticaly validate the input.

Clone this wiki locally