Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A resource-oriented web services framework

Project Description

Bedframe is a resource-oriented web services framework.

Installation

A Bedframe service runs on an underlying web server. Support for each particular web server is provided via a corresponding plugin. Bedframe releases include some web server plugins, which are activated by installing their corresponding package extras. These are the currently supported extras:

tornado
Support for the Tornado web server (via tornado.web.Application).
tornado_wsgi
Support for the Tornado WSGI web server (via tornado.wsgi.WSGIApplication).

For example, to install Bedframe with support for the Tornado WSGI web server, you can run

pip install bedframe[tornado_wsgi]

In addition, Bedframe supports these other extras:

ldap
Support for the Lightweight Directory Access Protocol (LDAP) for authentication (via python-ldap).
memcached
Support for memcached for authentication (via python-memcached).
test_ldap
Support for the Lightweight Directory Access Protocol (LDAP) for automated testing (via Spruce-ldap and OpenLDAP).

Examples

“Hello, world” service

import bedframe as _bedframe
import bedframe.webtypes as _webtypes

class HelloWorldResource(_bedframe.WebResource):
    @_bedframe.webmethod(_webtypes.unicode)
    def get(self):
        return u'Hello, world!'

service = _bedframe.WebService(uris=('http://localhost:8080',))
service.resources[r'/helloworld'] = HelloWorldResource
service.start()

Example usage (Napper):

>>> import bedframe.webtypes as _webtypes
>>> import napper as _napper
>>> uri = 'http://localhost:8080/helloworld'
>>> response = _napper.request_uri('get', uri)
>>> hello = _napper.extract_retval(response, _webtypes.unicode)
>>> print hello
Hello, world!

Example usage (Requests):

>>> import requests as _requests
>>> uri = 'http://localhost:8080/helloworld'
>>> headers = {'Accept': ', '.join(('application/json', '*/*; q=0.01'))}
>>> response = _requests.get(uri, headers=headers)
>>> hello = response.json()['retval']
>>> print hello
Hello, world!

Example usage (HTTPie):

$ uri='http://localhost:8080/helloworld'
$ http get "$uri" Accept:'application/json,*/*; q=0.01' --body
{
    "auth_info": {
        "accepted": null,
        "realm": null,
        "user": null
    },
    "retval": "Hello, world!",
    "type": "bedframe._responses._return:WebReturnResponse"
}

Changelog

0.13.0 (2013-10-11)

  • First public version.
Release History

Release History

This version
History Node

0.13.5

History Node

0.13.4

History Node

0.13.3

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Bedframe-0.13.5-py2.7.egg (121.6 kB) Copy SHA256 Checksum SHA256 2.7 Egg Jan 24, 2014
Bedframe-0.13.5-py27-none-any.whl (130.7 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jan 24, 2014
Bedframe-0.13.5.tar.gz (102.3 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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