A resource-oriented web services framework
Project description
Bedframe is a resource-oriented web services framework.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Bedframe-0.13.3.tar.gz
(101.0 kB
view details)
Built Distributions
Bedframe-0.13.3-py27-none-any.whl
(129.3 kB
view details)
Bedframe-0.13.3-py2.7.egg
(120.8 kB
view details)
File details
Details for the file Bedframe-0.13.3.tar.gz
.
File metadata
- Download URL: Bedframe-0.13.3.tar.gz
- Upload date:
- Size: 101.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9efd5b14b9bf944b1bcae5d099578177d69b0855b3a9f1f3077bbca7a7366887 |
|
MD5 | fae6c063770c73c3033700b11738d727 |
|
BLAKE2b-256 | 86171519b85a3bbb81b24a5e651348ed6092c1cdc76a060cf7fa0a1e4303afe3 |
Provenance
File details
Details for the file Bedframe-0.13.3-py27-none-any.whl
.
File metadata
- Download URL: Bedframe-0.13.3-py27-none-any.whl
- Upload date:
- Size: 129.3 kB
- Tags: Python 2.7
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 496fa937231799a55b29ea8d7462745904a76f9a04c29e978cac0c2d2018ef99 |
|
MD5 | 2ac96a5ab48a4892a2308c233e881bf2 |
|
BLAKE2b-256 | 1340a00cb23fe991351829114268b3f3bbb2aca38f5d782df8757b6f15d29153 |
Provenance
File details
Details for the file Bedframe-0.13.3-py2.7.egg
.
File metadata
- Download URL: Bedframe-0.13.3-py2.7.egg
- Upload date:
- Size: 120.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54885aa8561f8680f88a964556e6396ac068fff56264eb87861042a03d0d5dae |
|
MD5 | 918f7d833a24e2f3d3bfdbb98e069b4c |
|
BLAKE2b-256 | 802f87a392c740ed306e964421049ec7e767709e4a6f98ec779d886ac523baab |