Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Pyramid RESTful Framework is designed to help coding REST CRUD endpoints with couple of lines of code.

Project description

Pyramid RESTful Framework is designed to help coding REST CRUD endpoints with couple of lines of code.


1. virtualenv myapp
2. pip install git+
3. pcreate -s starter myapp
4. cd myapp
5. pip install -e .


pserve development.ini

This will run a server and you can navigate your browser to

Adding prf resources.

In the __init__.main function of your pyramid app declare your resources:

def main():
root = config.get_root_resource()
user = root.add('user', view='prf.view.NoOp')
user_story = user.add('story', 'stories', view='prf.view.NoOp')

The following endpoints are declared with the code above:

You can now navigate to or

'NoOp' view as name suggests does not do much. You will need to create your own views for each resource.
In our case UsersView and UserStoriesView.

UsersView could look something like this:

from prf.view import BaseView

Users = [
'id': 0,
'id': 1,
'id': 2,

class UsersView(BaseView):

def index(self):
return Users

def show(self, id):
return Users[int(id)]

def create(self):

def delete(self, id):
del Users[id]

You need to change the view for the users resource to point to this class:
user = root.add('user', view=UsersView)

Restart the server and navigate to

Above we declared `index`, `show`, `create` and `delete` actions which correspond to: GET collection, GET resource, POST resource and DELETE resource respectively. You could also declare `update`, which would correspond to the PUT method. You dont need to declare all of them, only those you need. The missing ones will automatically return 405 Method Not Allowed error.

Comment out the `index` action and try.

Happy RESTing !


- Initial version

Project details

Download files

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

Files for prf, version 0.0.28
Filename, size File type Python version Upload date Hashes
Filename, size prf-0.0.28-py2-none-any.whl (57.7 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size prf-0.0.28.tar.gz (44.5 kB) File type Source Python version None Upload date Hashes View

Supported by

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