Microservice handler for cryptic-game
Project description
python3-lib
The microservice-libary for python3 of cryptic-game.
Pypi Seite: https://pypi.org/project/cryptic-game/
Installation:
$ pip3 install cryptic-game
Quick Start
from cryptic import MicroService, get_config, Config
from uuid import uuid4
from sqlalchemy import Column, String
from typing import Union
config: Config = get_config("debug") # this sets config to debug mode
ms: MicroService = MicroService(name="echo")
db_wrapper = ms.get_wrapper()
@ms.microservice_endpoint(path=["microservice"])
def handle(data: dict, microservice: str):
print(data, microservice)
return {}
@ms.user_endpoint(path=["user"])
def handle(data: dict, user: str):
print(data, user)
return {}
class Test(db_wrapper.Base):
__tablename__: str = 'test'
uuid: Union[Column, str] = Column(String(36), primary_key=True, unique=True)
name: Union[Column, str] = Column(String(255), nullable=False)
@staticmethod
def create(name: str) -> 'Test':
my_test: Test = Test(uuid=str(uuid4()), name=name)
return my_test
if __name__ == '__main__':
ms.run()
Requirements
Required are all modules in the requirements.txt
.
Test it!
Your microservice will be supported by the game-server of cryptic.
Environment variables
key | default value |
---|---|
SERVER_HOST | 127.0.0.1 |
SERVER_PORT | 1239 |
Wiki
Visit our wiki for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cryptic-game-0.3.0.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for cryptic_game-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f7c10ac06c0c9cd3ede5524f3dc82ce73a9384cc1373ef455e0e0e8630480e |
|
MD5 | c4fb9e27fd265076840eb353ac2a9cbc |
|
BLAKE2b-256 | 0d487a7cb2fea15c3ff0b2aecf8f8effff08b52ae5ad3bec2f3f1ba7bec48b38 |