django-piston

Recommended configuration for both web client and mobile REST api security

本小妞迷上赌 提交于 2019-12-03 17:35:16
问题 I realize there are a ton of questions on this subject, and I have been researching this for a couple days now. I want to make sure my question is as specific as possible since I have yet to gain a full understanding of the best approach. Currently I have a developed django site, with the web client communicating probably about 95% via a django-piston json REST api. The other 5% is some remaning login functionality that still goes through POST forms with CSRF protection. Ideally I would like

I get a 400 Bad Request error while using django-piston

若如初见. 提交于 2019-12-03 12:16:32
问题 I am trying to use Piston to provide REST support to Django. I have implemented my handlers as per the documentation provided . The problem is that i can "read" and "delete" my resource but i cannot "create" or "update". Each time i hit the relevant api i get a 400 Bad request Error. I have extended the Resource class for csrf by using this commonly available code snippet: class CsrfExemptResource(Resource): """A Custom Resource that is csrf exempt""" def __init__(self, handler,

Running Django-Celery in Production

有些话、适合烂在心里 提交于 2019-12-03 11:18:39
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 on a proper apache server. The web application and web services work fine in production but I'm having serious issues starting celeryd as a daemon. Based on these instructions: http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#running-the-worker

Recommended configuration for both web client and mobile REST api security

末鹿安然 提交于 2019-12-03 06:33:26
I realize there are a ton of questions on this subject, and I have been researching this for a couple days now. I want to make sure my question is as specific as possible since I have yet to gain a full understanding of the best approach. Currently I have a developed django site, with the web client communicating probably about 95% via a django-piston json REST api. The other 5% is some remaning login functionality that still goes through POST forms with CSRF protection. Ideally I would like to move the remainder also into the REST api. I am at the point now where I need to figure out the best

What is the right way to write a django-piston client?

邮差的信 提交于 2019-12-03 05:18:09
问题 I've been reading a lot on django-piston and using to to make an API for an app I'm development, but I'm getting hung up on the client side of the world. I've written the handlers and uri mappings, and I can return JSON or XML to my heart's content. Where I'm getting stuck is what to do with that now. My ideal endgame is to have an iPhone and Android client consume and return data, but I don't know the right way to handle authentication. The easiest way I can figure is saving the username and

RESTFUL web services consumed by web and native mobile apps with authentication in python using django framework

浪子不回头ぞ 提交于 2019-12-03 00:29:51
I have to write RESTFUL web-services with authentication in python using django framework which will be consumed by web based clients and mobile native apps (Android and IOS). the simple example would be that user will log in using email and password, he fetches the api key and stores it on the mobile device and then use this api key for consuming further api's instead of giving user credentials again and again. I am thinking of using TASTYPIE or Django piston for writing RESTFUL services but please suggest otherwise if you know any better solution. But my main focus is on the authentication

How to access the request.user in a Piston classmethod

南楼画角 提交于 2019-12-01 08:53:52
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 implemented as a class method, which when called in Piston does not get a reference to the request object, and therefore I have no way to know who the current user is. From the Piston docs: In addition to these, you may define any other methods you want. You can use these by

How to access the request.user in a Piston classmethod

≡放荡痞女 提交于 2019-12-01 06:02:54
问题 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 implemented as a class method, which when called in Piston does not get a reference to the request object, and therefore I have no way to know who the current user is. From

How to ensure that a python dict keys are lowercase?

主宰稳场 提交于 2019-11-30 19:42:59
I have a dict that I want to convert in JSON using simplejson. How can I ensure that all the keys of my dict are lowercase ? { "DISTANCE": 17.059918745802999, "name": "Foo Bar", "Restaurant": { "name": "Foo Bar", "full_address": { "country": "France", "street": "Foo Bar", "zip_code": "68190", "city": "UNGERSHEIM" }, "phone": "+33.389624300", "longitude": "7.3064454", "latitude": "47.8769091", "id": "538" }, "price": "", "composition": "", "profils": {}, "type_menu": "", "ID": "" }, EDIT: Thanks all to had a look at my question, I am sorry I didn't explain in detailed why I wanted this. It was

How to ensure that a python dict keys are lowercase?

ε祈祈猫儿з 提交于 2019-11-30 02:43:41
问题 I have a dict that I want to convert in JSON using simplejson. How can I ensure that all the keys of my dict are lowercase ? { "DISTANCE": 17.059918745802999, "name": "Foo Bar", "Restaurant": { "name": "Foo Bar", "full_address": { "country": "France", "street": "Foo Bar", "zip_code": "68190", "city": "UNGERSHEIM" }, "phone": "+33.389624300", "longitude": "7.3064454", "latitude": "47.8769091", "id": "538" }, "price": "", "composition": "", "profils": {}, "type_menu": "", "ID": "" }, EDIT: