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
0
votes
1 answer

django-piston: How do I make an emitter return a downloadable file?

I have the following emitter: class iCalEmitter(Emitter): def render(self, request): data = self.construct() cal = Calendar() cal.add('prodid', 'iCalendar Feed') cal.add('version', '2.0') for event in…
Jon Mooring
  • 151
  • 2
  • 13
0
votes
1 answer

jQuery post form with file to REST API

I have a form with enctype = "multipart / form-data". I need to send it to the REST API for uploading. The server is using Django and piston. Advise me how best to do this please. As of JavaScript (backbone) to serialize it into JSON with the file.…
moskrc
  • 1,220
  • 1
  • 12
  • 23
0
votes
1 answer

Easy to setup, multi-threaded server for my Django Piston API

I am writing an API that reads from MySQL and Solr (which can give latencies of 150ms) to provide formatted output. I will be hosting this on a VPS, and I need to choose a web server for this application. It will be used only within localhost (and…
Jesvin Jose
  • 22,498
  • 32
  • 109
  • 202
0
votes
1 answer

What is the reason that Piston needs to remove the OAuth keys from the request?

I posted the question in here as well but dont seem get answered.. https://bitbucket.org/jespern/django-piston/issue/194/what-is-the-reason-that-piston-needs-to
0
votes
0 answers

Can't describe POST request with BaseHandler

sorry for my bad english get request works fine, the data is displayed correctly, but it's not possible to add new data, it shows a server error status 500 Class Test(models.Model): id = models.AutoField(u'id', primary_key=True) name =…
0
votes
1 answer

Django piston message encode problem

I have a project on Django 1.3 + piston for API. This is the code of GET handler: listen_resource = Resource( ListenHandler ) urlpatterns = patterns('', url( r'^listen/(?P.*)$', listen_resource ), ) class…
Daler
  • 814
  • 14
  • 28
0
votes
1 answer

Django piston, Django.auth, and asihttprequest

I have a website that uses Django piston for the API. I have also created an iPhone app that successfully connects to the API and parses the JSON and displays the correct content on the iPhone. The API resource URLs are as…
django-d
  • 2,210
  • 3
  • 23
  • 41
0
votes
1 answer

piston-django how many methods should a single handler contain

I've been building a handler class for each method I want to map to the url file. Is my approach correct or wrong? because I don't seem to find a way to map a resource to a method they all map to an entire class. Regards,
Mo J. Mughrabi
  • 6,747
  • 16
  • 85
  • 143
0
votes
2 answers

Ajax call for a Django(Piston) API always fail

I'm using an ajax call to my API created with Piston/Django. I tested that the API URLs are correct by directly typing them in the browser. However, the ajax request always triggers the error callback function but returns an undefined error. I think…
Wei An
  • 1,779
  • 4
  • 13
  • 18
0
votes
1 answer

To soon to attempt using Django-Piston with OAuth-2 for my API in production?

We've currently got a Django application that uses Piston to serve a number of API endpoints, which perform a mix of reading and writing data from the the application. Adding an authentication layer, probably OAuth-2 is the next task in our dev.…
Trindaz
  • 17,029
  • 21
  • 82
  • 111
0
votes
1 answer

django-piston generated documentation for several handlers

I'm having a problem regarding the automagic documentation generated in django-pyston. Right now I have this and works: from piston.handler import BaseHandler from piston.doc import generate_doc class FirstHandler(BaseHandler): ... doc =…
anders
  • 825
  • 2
  • 10
  • 18
0
votes
1 answer

how to read an lxml.objectify.ObjectifiedElement object with django-piston?

I am trying to make a django-piston API which reads another API and presents it in a different format (reads an XML-only API and presents it in JSON). But I am having trouble, because the way I am doing it I just an empty string. Here is my…
ria
  • 7,198
  • 6
  • 29
  • 35
0
votes
1 answer

Greasemonkey POST request always returns 400 error

I have a django application which is exposing a API whose url conf look like this, url('^links/', linkhandler), The link handler is a django piston resource whose POST(Create function) I have given below, def create(self, request): try: …
tamizhgeek
  • 1,371
  • 3
  • 13
  • 25
0
votes
1 answer

Django-Piston and Python Client Vs Java Client

I've built a web service using Django-Piston that allows for POST and GET requests. As part of testing I wrote a quick Python script. Using the script I can successfully do both types of requests; however, when a client written in Java attempts to…
Przemek
  • 459
  • 7
  • 16
0
votes
1 answer

django-piston: properly formatting POST data from a client application

I have a Django app running django-piston for the first time. I've got a handler configured for a model and it's rigged for GET and POST. GET works fine. Tried and true. POST however is sucking. When I post data to it, I am getting this…
M. Ryan
  • 6,973
  • 11
  • 52
  • 76