You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MaxiHuHe04 edited this page Nov 1, 2019
·
3 revisions
Cryptic-Game Python3-Lib
🔥 This guide does not explain how this library works internally. It is just a quick guide on which features it provides. 🔥
Installation
pip3 install cryptic-game
Enviroment Variables
Variable
Functionality
MODE
Available: debug and production
SERVER_HOST
Hostname of the main server
SERVER_PORT
Microservice communication port of the main server
DATA_LOCATION
SQLite database file location
DBMS
Database management system; Available: mysql and sqlite
SQLITE_FILE
Name of the SQLite database file (only used if DBMS is sqlite)
MYSQL_HOSTNAME
Hostname of the MySQL server
MYSQL_PORT
Port of the MySQL server
MYSQL_DATABASE
Name of the MySQL database to use
MYSQL_USERNAME
MySQL username to use
MYSQL_PASSWORD
The password of the MySQL user
PATH_LOGFILE
Path where your log-files will be stored to
DSN
"Data Source Name" of your Sentry instance
RELEASE
The release that will be reported to Sentry
Requirements
See the requirements.txt
Init your Microservice
fromcrypticimportMicroservicem=Microservice("your_ms_name")
# Database wrapper, relevant for laterwrapper=m.get_wrapper()
Defining endpoints
fromschemeimportTextm.user_endpoint(path= ["info"], requires= {"user_name": Text()}
definfo(data: dict, user: str):
return {"message": "Hi "+data["user_name"] +", your uuid is "+user}
You can specify under which path this endpoint is reachable and which input scheme it needs. The library will automatically validate the input and return {"error": "invalid_input_data"} if it isn't valid.