Skip to main content

This is a lightweight microframework for building restful APIs

Project description


This is a lightweight microframework for building restful APIs
from krull.handlers import route_handler
from krull.server import run_server

@endpoint(path='/users/<int:id>', method='GET')
def getusers(req, res, *args, **kwargs):
res.status = 200
user_id = kwargs.get("id") = {"message": "Hello world, number {}!".format(user_id)}
return res

@endpoint(path='/users/<str:username>', method='GET')
def getuserbyusername(req, res, *args, **kwargs):
res.status = 200
username = kwargs.get("username") = {"message": "Hello world, and hey {}!".format(username)}
return res

@endpoint(path='/users', method='POST')
def postusers(req, res):
# do something with data
res.status = 201 = {"message": "success!"}
return res

if __name__ == '__main__':

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krull-0.0.4.tar.gz (1.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page