Package: smapy
SmapySimple Modular APIs written in Python.Free software: MIT licenseDocumentation:https://smapy.github.io/smapyOverviewSmapyis a framework built on top ofFalconandgunicorn, which allows building modular, distributed and
asynchronous-capable service oriented Web APIs writing as little Python code as possible.InstallationThe simplest and recommended way to installSmapyis usingpip:pipinstallsmapyAlternatively, clone the repository and install it from source running themake installcommand.gitclonegit@github.com:smapy/smapy.gitcdsmapy
makeinstallFor development, you can use themake install-developcommand instead in order to install all
the required dependencies for testing and code linting.Getting StartedAll you need to start aSmapyapplication is to execute thesmapycommand line utility:$smapy[2018-12-2921:53:03+0100][25213][INFO]Startinggunicorn19.9.0[2018-12-2921:53:03+0100][25213][INFO]Listeningat:http://127.0.0.1:8001(25213)[2018-12-2921:53:03+0100][25213][INFO]Usingworker:gevent[2018-12-2921:53:03+0100][25216][INFO]Bootingworkerwithpid:252162018-12-2921:53:03,304-25216-INFO-None-application-InitializingtheAPI2018-12-2921:53:03,307-25216-INFO-None-api-Addingnewrunnablehello.World2018-12-2921:53:03,307-25216-INFO-None-api-Addingnewrunnablemisc.MultiProcess2018-12-2921:53:03,307-25216-INFO-None-api-Addingnewrunnablemisc.Report2018-12-2921:53:03,308-25216-INFO-None-api-Addingnewrunnablemisc.HelloWorldAfter that, you can start playing with it through HTTP requests:$ curl localhost:8001/hello
{
    "elapsed": 0.08,
    "host": "hostname",
    "in_ts": "2018-05-06T20:37:48.671867",
    "out_ts": "2018-05-06T20:37:48.671947",
    "pid": 31789,
    "results": null,
    "session": null,
    "status": "404 Not Found"
}

$ curl localhost:8001/hello_world
{
    "elapsed": 12.044,
    "host": "hostname",
    "in_ts": "2018-05-06T20:37:58.759039",
    "out_ts": "2018-05-06T20:37:58.771083",
    "pid": 31789,
    "results": null,
    "session": "5aef67a6ab17857c2d81a6ea",
    "status": "200 OK"
}

$ curl localhost:8001/hello_world?sync=True
{
    "elapsed": 26.668,
    "host": "hostname",
    "in_ts": "2018-05-06T20:38:03.903315",
    "out_ts": "2018-05-06T20:38:03.929983",
    "pid": 31789,
    "results": {
        "hello": "world!",
        "sync": "True"
    },
    "session": "5aef67abab17857c2d81a6ec",
    "status": "200 OK"
}

$ curl localhost:8001/report?session=5aef67a6ab17857c2d81a6ea
{
    "elapsed": 19.758,
    "host": "hostname",
    "in_ts": "2018-05-06T20:39:49.670267",
    "out_ts": "2018-05-06T20:39:49.690025",
    "pid": 31789,
    "results": {
        "actions": {
            "OK": 1
        },
        "last_activity": "2018-05-06T20:37:58.812000",
        "session": {
            "_id": "5aef67a6ab17857c2d81a6ea",
            "alive": false,
            "body": {},
            "elapsed": "0:00:00.058000",
            "env": {
                "HTTP_ACCEPT": "*/*",
                "HTTP_HOST": "localhost:8001",
                "HTTP_USER_AGENT": "curl/7.47.0",
                "PATH_INFO": "/hello_world",
                "QUERY_STRING": "",
                "RAW_URI": "/hello_world",
                "REMOTE_ADDR": "127.0.0.1",
                "REMOTE_PORT": "50636",
                "REQUEST_METHOD": "GET",
                "SCRIPT_NAME": "",
                "SERVER_NAME": "127.0.0.1",
                "SERVER_PORT": "8001",
                "SERVER_PROTOCOL": "HTTP/1.1",
                "SERVER_SOFTWARE": "gunicorn/19.8.1"
            },
            "host": "hostname",
            "in_ts": "2018-05-06T20:37:58.759000",
            "out_ts": "2018-05-06T20:37:58.817000",
            "params": {},
            "pid": 31789,
            "resource": "misc.HelloWorld",
            "response": {
                "hello": "world!"
            },
            "status": "OK",
            "sync": false
        },
        "session_data": {
            "links": 0,
            "occurrences": 0,
            "post": 0
        }
    },
    "session": "5aef6815ab17857c2d81a6ef",
    "status": "200 OK"
}History0.0.3New release scripts.0.0.2AddsmapyCLIAdd default actions ands resourcesImport actions dynamicallyUpdate project structure0.0.1First release on PyPI.