This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

aiohttp_rest makes it easy to create RESTful aiohttp endpoints that bind directly to models with minimal modification.

Usage

Create your model:

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

Create an aiohttp application that makes use of a aiohttp_rest.RestResource:

from aiohttp.web import Application, run_app
from aiohttp_rest import RestResource

from person import Person


people = {}

app = Application()
person_resource = RestResource('people', people, Person, ('name', 'age'), 'name')
person_resource.register(app.router)

run_app(app)

Interact with the API:

http POST localhost:8000/people name=andrew age=24
http localhost:8000/people/andrew
http PUT localhost:8000/people/andrew/age age=25
http DELETE localhost:8000/people/andrew

Several things are required by the RestResource to make all this work:

  • A name for the resource, this will form the base of the URL.
  • A factory method for the model, as seen above, this can simply be the init method for the model or something more complex.
  • A collection to store the models, this should be a dict-like object.
  • A list of properties to expose to the API.
  • A property to treat as the id for the collection. In the above example we used the name as the id, so that’s what we used in our URLs to refer to a specific instance in the collection.

Installing

git clone github.com/atbentley/aiohttp_rest
cd aiohttp_rest
python setup.py install

Tests

pip install -r build-requirements.txt
py.test tests

License

MIT

Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aiohttp-rest-0.1.0.tar.gz (6.8 kB) Copy SHA256 Checksum SHA256 Source Apr 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting