def api():
	if(request.method == 'POST'):
		return "Expected GET parameters but got POST instead"
	elif(request.method == 'GET'):
		data = request.args
		return serve_api(data)
	else:
		return "No arguments provided"
Exemple #2
0
from api import handle_request, serve_api

import sqlite3

con = sqlite3.connect(":memory:")

fields = [
    Field('id', int, pk=True),
    Field('title', str),
    Field('isbn', str),
    Field('condition', str)
]
books_table = Table('book', fields)
Book = link_table(books_table, con)

fields = [
    Field('id', int, pk=True),
    Field('name', str),
    Field('age', int),
    Field('happy', bool)
]
people_table = Table('person', fields)
Person = link_table(people_table, con)

Person.has_one(Book)

person = Person()
book = Book()
    
print serve_api(Book, Person)