Questions tagged [django-piston]

A mini-framework for Django for creating RESTful APIs.

Piston is a relatively small Django application that lets you create application programming interfaces (API) for your sites.

It has several unique features:

  • Ties into Django's internal mechanisms.
  • Supports OAuth out of the box (as well as Basic/Digest or custom auth.)
  • Doesn't require tying to models, allowing arbitrary resources.
  • Speaks JSON, YAML, Python Pickle & XML (and HATEOAS.)
  • Ships with a convenient reusable library in Python
  • Respects and encourages proper use of HTTP (status codes, ...)
  • Has built in (optional) form validation (via Django), throttling, etc.
  • Supports streaming, with a small memory footprint.
  • Stays out of your way.

NB: OAuth ships with piston for now, but you are not required to use it. It simply provides some boilerplate in case you want to use it later (consumer/token models, urls, etc.)

Learn More:

Piston Bitbucket Wiki

Piston Documentation

159 questions
4
votes
2 answers

How to use sessions with django piston auth?

The problem is that I want to store authentication in a cookie that I can present to django piston rather than requiring user/password to be typed in each time (without hardcoding or storing the user/pass combo somewhere on disk). I was hoping to…
dlamotte
  • 6,145
  • 4
  • 31
  • 40
4
votes
2 answers

Is Piston ready for OAuth?

I tried using Piston for a simple API, hoping to use its OAuth support. But the first time I hit the endpoint after enabling OAuth, I got an error: TemplateDoesNotExist: oauth/challenge.html and sure enough, there is no such file. Does OAuth…
Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
3
votes
2 answers

Django + SQLAlchemy + RESTful API (tastypie?)

I am currently using Django with SQLAlchemy, and would like to implement an (simple to begin with) API for mobile devices. Am evaluating at different python RESTful API frameworks, particularly tastypie and piston. Can someone please point me to the…
jho
  • 1,684
  • 1
  • 16
  • 17
3
votes
1 answer

How to update a model but return unmodified model in Django?

I'm using django-piston to write a RESTful Web Service and have a problem. in models.py: class Status(models.Model): user = models.ForeignKey(User) content = models.TextField(max_length=140) class StatusReply(models.Model): user =…
Clippit
  • 856
  • 1
  • 9
  • 20
3
votes
2 answers

Sync django-piston models when using egg module

I'm using django-piston and running into the following problem when running the manage.py syncdb command: Traceback (most recent call last): File "./manage.py", line 13, in execute_manager(settings) File…
Andrew C
  • 3,560
  • 1
  • 23
  • 24
3
votes
1 answer

django-piston: request.data availability within DELETE handlers

django-piston appears to create a data attribute on the request object before it gets to the Handler phase. This data is available, for example, in the PUT and POST handlers by accessing request.data. However, in the DELETE handler, the data is not…
M. Ryan
  • 6,973
  • 11
  • 52
  • 76
3
votes
3 answers

How to manipulate the response object in django-piston?

I have some existing python code that uses django-piston which returns a dictionary as its response. For example: from piston.handler import BaseHandler class FooHandler(BaseHandler): allowed_methods = ('GET',) @classmethod def…
Michael Wehner
  • 753
  • 2
  • 6
  • 13
3
votes
1 answer

How to set an HTTP header for a JSON message from within a django-piston handler?

In a piston handler, I need to return a django.db.models.query.QuerySet as a proper JSON message (reflective of the underly model and query), while also adding an HttpResponse header of my own. So far, I can do one or the other, but not both (and…
3
votes
2 answers

How to access the request.user in a Piston classmethod

I have a model which contains a ManyToMany to User to keep track of which users have 'favorited' a particular model instance. In my API for this model, when requested by an authenticated user, I'd like to include an 'is_favorite' boolean. However,…
Chris Lawlor
  • 47,306
  • 11
  • 48
  • 68
3
votes
2 answers

Django POST sub-dictionaries

I'm making the following request through command-line cURL: curl -X POST http://localhost:8000/api/places/ -vvvv -d "place[name]=Starbucks" However, when I try to access the parameters by calling request.POST.getlist('place') I get an empty array…
Jamie Rumbelow
  • 4,967
  • 2
  • 30
  • 42
3
votes
4 answers

Can django-piston module create upload image restful webservice

I trying to restful server that one can upload image, By use django-piston I can put,get,post information restfully but don't know how to upload image.
vernomcrp
  • 3,459
  • 11
  • 34
  • 44
3
votes
2 answers

python list mysteriously getting set to something within my django/piston handler

Note: (I've updated this since the first two suggestions... you can view the old post in txt form here: http://bennyland.com/old-2554127.txt). The update I made was to better understand what was going wrong - and now I at least sort of know what's…
user306127
3
votes
2 answers

Using django-piston, how can I write out HTTP headers in the response?

How can I include an HTTP header, such as Cache-Control or Last-Modified, in the response to a django-piston call?
user304520
  • 31
  • 2
3
votes
1 answer

Descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode'

I am using piston to write a JSON api for an application I am writing which handles recurring calendar events. My API was working for regular events, when I attempted to add logic to handle the recurrence, I started getting the following…
Matthew Calabresi
  • 487
  • 2
  • 11
  • 20
2
votes
1 answer

webservice + facebook-connect

I'm working on a project that consist in an IOS App and a webservice written using django-piston. Right now I'm using basic HTTP Auth use the webservice. Any idea of how can i integrate facebook connect to authenticate users to use the…
Emmet Brown
  • 456
  • 6
  • 21
1 2
3
10 11