The Python AsyncIO REST API Framework¶
(REST Resource Application Server)
Guillotina is the only full-featured Python AsyncIO REST Resource Application Server designed for high-performance, horizontally scaling solutions. It is a high performance web server based on many of the technologies and lessons learned from Plone, Pyramid, Django and others all while utilizing Python’s great AsyncIO library.
Using Python’s AsyncIO, it works well with micro-service oriented environments.
- Features:
- REST JSON API
- Built-in authentication/authorization, built-in JWT support
- Hierarchical data/url structure
- Permissions/roles/groups
- Fully customizable permission/roles/groups based on hierarchical data structure
- Robust customizable component architecture and configuration syntax
- Content types, dynamic behaviors
- Built-in CORS support
Detailed Documentation¶
What is Guillotina like?¶
Example configuration:
---
applications:
- guillotina_dbusers
- myapp
databases:
- db:
storage: postgresql
dsn:
scheme: postgres
dbname: guillotina
user: postgres
host: localhost
password: ''
port: 5432
port: 8080
root_user:
password: root
Example service:
from guillotina import configure
@configure.service(name='@foobar')
async def foobar(context, request):
return {"foo": "bar"}
Example content type:
from guillotina import configure
from guillotina import content
from guillotina import Interface
from guillotina import schema
class IMyType(Interface):
foobar = schema.TextLine()
@configure.contenttype(
type_name="MyType",
schema=IMyType,
behaviors=["guillotina.behaviors.dublincore.IDublinCore"])
class Foobar(content.Item):
pass
Example usage:
-
POST
/db/container
¶ Create MyType
Example request
POST /db/container HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Basic cm9vdDpyb290 { "@type": "MyType", "id": "foobar", "foobar": "foobar" }
Example response
HTTP/1.1 201 OK Content-Type: application/json
Request Headers: - Authorization – Required token to authenticate
Status Codes: - 201 Created – no error
- 401 Unauthorized – Invalid Auth code
- 500 Internal Server Error – Error processing request
-
GET
/db/container/foobar/@foobar
¶ Get MyType
Example request
GET /db/container/foobar HTTP/1.1 Accept: application/json Authorization: Basic cm9vdDpyb290
Example response
HTTP/1.1 201 OK Content-Type: application/json {"foo": "bar"}
Request Headers: - Authorization – Required token to authenticate
Status Codes: - 200 OK – no error
- 401 Unauthorized – Invalid Auth code
- 500 Internal Server Error – Error processing request