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
6
votes
3 answers

Piston customize response representation

I am using piston and I would like to spit out a custom format for my response. My model is something like this: class Car(db.Model): name = models.CharField(max_length=256) color = models.CharField(max_length=256) Now when I issue a GET…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
5
votes
2 answers

Django Piston: How can I exclude nested fields from handler results? Is it even possible?

I am putting the finishing touches on an API I have written for a Django app utilizing django-piston. The API is able to search by request or IP address which are Request or IPAddress instances respectively. Each request can have 1 or more…
jathanism
  • 33,067
  • 9
  • 68
  • 86
5
votes
2 answers

'HttpResponse' has no attribute '_get_content

I am using Django 1.5.1 and Piston for rest support with MongoDB database. When trying to test the rest url to retrieve the data, I get the following error. type object 'HttpResponse' has no attribute '_get_content' Request Method: GET Request URL: …
tank
  • 319
  • 6
  • 15
5
votes
3 answers

Is it possible to use django Piston on Google AppEngine?

I haven't been able to do so due to all sort of missing dependencies (mainly, I think the problem is in the authentication code which relies on django stuff that is not available on AppEngine) I was wondering if anyone patched\forked piston to get…
Eran Kampf
  • 8,928
  • 8
  • 49
  • 47
5
votes
2 answers

Analytics for tastypie

I am looking to add some sort of analytics to my Tastypie-powered API. I really enjoy Google Analytics for the regular web site however obviously it won't work for an API. How do you do analytics for APIs in general? And are there any packages…
miki725
  • 27,207
  • 17
  • 105
  • 121
4
votes
1 answer

Python Piston equivalent for consuming RESTful APIs?

Is there something equivalent of Django Piston but for consuming RESTful API's?
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
4
votes
2 answers

Exception was: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'

I am new with python and I am making a system that deals with request.GET method... when i pass a date to the system, if it is exist then it will look for the database and show data according to that date and other dates, else it will display a…
gadss
  • 21,687
  • 41
  • 104
  • 154
4
votes
2 answers

ValueError: Cannot assign in django

I have encountered a problem when I was trying to add/post a data to my models. this is what i have done in my python manage.py shell: >>> from booking.models import * >>> qa = Product.objects.get(id=5) >>> sd = Booking.objects.create( ...…
gadss
  • 21,687
  • 41
  • 104
  • 154
4
votes
2 answers

How to prevent 'IOError: failed to write data' when client closes connection to Django/WSGI app?

I have an iPhone app that is using web services implemented in Python, using Django and Piston, running on an apache server through WSGI. Sometimes the app closes its connection to the server before a call is finished. When it does this it causes…
Josh Knauer
  • 1,744
  • 2
  • 17
  • 29
4
votes
1 answer

Django Piston forks confusion

I've noticed that there are about 30 forks of Django Piston on GitHub: https://github.com/search?q=django-piston&type=Everything&repo=&langOverride=&start_value=1 My problem with that framework is that both 0.2.2 and 0.2.1 versions seem not to…
julx
  • 8,694
  • 6
  • 47
  • 86
4
votes
1 answer

OAuth web service and Django-piston

I am trying to implement a web service with filtered resources access (OAuth authentication) with Django and I had a couple of questions. I created two webservers: http://localhost:8080 : Web Service Provider (using django-piston for the…
nbarraille
  • 9,926
  • 14
  • 65
  • 92
4
votes
1 answer

Django-piston file uploading

I am using django-piston and curl to post file to specific phone numbers in my database. But I'm having problems uploading files. This is my post response using curl: C:\curl>curl -F "phone_number=03219455375" -F…
hassanadnan
  • 435
  • 3
  • 8
  • 17
4
votes
2 answers

Can't exclude ForeignKey fields for User in Piston

I have this model: # models.py from django.contrib.auth.models import User class Test(models.Model): author = models.ForeignKey(User, related_name="tests") title = models.CharField(_("title"), max_length=100) Then in the api folder for the…
Menda
  • 1,783
  • 2
  • 14
  • 20
4
votes
1 answer

What is the best way to consume a django-piston REST API from a Django view?

I have started using django-piston for creating APIS but I am having trouble finding documentation on how to consume the API from inside django with python. I have seen examples using javascript. So far I am using urllib to access the API but I…
adeleinr
  • 665
  • 7
  • 14
4
votes
3 answers

Django: custom serialization options?

I'm working on a Django-based web service and I'm trying to figure out what the best way to do my serialization will be. The tricky requirement, though, is that I'd like to have pretty much full control over format of, and fields contained in, the…
David Wolever
  • 148,955
  • 89
  • 346
  • 502
1
2
3
10 11