Exemplo n.º 1
0
import json
import datetime

from collections import OrderedDict

from flask import Flask

from thorium import (
    ThoriumFlask,
    RouteManager,
    Resource,
    fields,
    Endpoint,
)

routing = RouteManager()


class PersonResource(Resource):
    id = fields.IntField(default=None)
    name = fields.CharField()
    birth_date = fields.DateTimeField()
    admin = fields.BoolField(default=False)


class CollectionParams(Resource):
    times = fields.IntField(required=True, default=1)


@routing.collection(path='/api/event/<int:event_id>/people',
                    methods=('get', 'post'),
Exemplo n.º 2
0
 def setUp(self):
     self.route_manager = RouteManager()