django-piston

Django/piston + Silverlight, PUT/DELETE?

I am working on a Silverlight project that uses Django on the server using piston for the REST API. I understand that Silverlight doesn't support the PUT and DELETE http verbs. Is there another way i can pass these kinds of commands to piston? ...

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? ...

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 accomplish this with cookies like someone would without the piston API. Am I missing somet...

(O)Auth with ExtJS

Hi, today i tried to get django-piston and ExtJS working. I used the ExtJS restful example and the piston example to create a little restful webapp. Everything works fine except the authentication. Whats the best way to get Basic/Digest/OAuth authentication working with ExtJS? Atm I'm not sure where to set the Username/Password. Than...

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. ...

Making REST calls only available to local applications?

Suppose I have a url like http://mysite.com/get-users which returns a JSON object of all users. But, I don't want anyone (or any bots) to be able to go to this url to fetch this information. I want it to only respond to calls from other local modules in the same website. How would I go about implementing someting like this? ...

django-piston: how to get values of a many to many field ?

I have a model with ManyToManyField to another model. I would like to get all the info on a particular record (including the related info from other models) return by JSON. How to get django-piston to display those values? I would be happy with just primary keys. Or can you suggest another option ? ...

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 response. For example, the Django serializers (which, unfortunately, includes the wadofst...

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 as a response. How can I access the sub-dictionary which I can then pass to the ORM? ...

Running Django-Celery in Production

I've built a Django web application and some Django-Piston services. Using a web interface a user submits some data which is POSTed to a web service and that web service in turn uses Django-celery to start a background task. Everything works fine in the development environment using manage.py. Now I'm trying to move this to production o...

Django Piston issue - "oauth_user_auth() takes exactly 1 argument (2 given)"

I am having a few problems setting up Django Piston. I have managed to get as far as generating authentication via the oauth_client.py sample shown here (http://github.com/clemesha/django-piston-oauth-example). When I run "python oauth_client.py" i am taken to http://localhost:8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs wher...

Complete 'django piston with oauth support' example

Hi, I have followed a number of tutorials and examples on the web to setup and use django piston. They all work flawlessly, until i try to integrate oauth authentication. I have been working against the following examples: http://blog.carduner.net/2010/01/26/django-piston-and-oauth/ http://github.com/clemesha/django-piston-oauth-exampl...

Django Piston Content Type Always Null

I had django-piston working a week ago but recently I'm unable to call any web services. Below is a simple example. I have a 'test' service that returns 'yes' if there is a content type and 'no' if content type is null. I've done this because I get HTTP 500 errors when I do a POST and try to parse my parameters via 'data = request.data'....

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, it seems that any api fields that aren't straight model attributes must be implemebted as ...

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 get a proper looking JSON response). The below generates a proper JSON formatted response, ...

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 create(self, request): return { 'foo': 'bar' } This code works fine, and is serialized...

Handling related models in Django for use in Django-Piston

I have setup like so (changed for simplicity) class Author(models.Model) name = models.CharField(max_length=100) ... class Document(models.Model): title = models.CharField(max_length=200) content - models.TextField() author = models.ForeignKey("Author", related_name="documents") date_published = models.DateTimeF...

Is django-piston mature enough?

Hello. I'm developing an advertising site. Want to use Web-Services for the requests. I mean, a publisher site will put a JS snippet and it will pull a banner through a REST GET. Is this framework mature enough to implement this functionality? Thanks ...

How to return a formated error message and the right HTTP code using django-piston ?

Hello, I would like to be able to return a HTTP Reponse with a formated content with django-piston. I guess I have to create my own rc_factory. What I would like to do is : return rc.404({'status': 0,'message': 'This restaurant does not exists.'}) With a result provide by XMLEmiter, JSONEmiter or YAMLEmiter regarding to the format ...

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

Hi all, 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 wonder if this is the best approach. I appreciate your input on this! ...