django-piston

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

可紊 提交于 2019-12-07 16:21:17
问题 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 error: descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode' Here is my handlers.py : from piston.handler import BaseHandler from lessons.models import NewEvent, EachEvent import calendar from datetime import datetime, timedelta

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

六月ゝ 毕业季﹏ 提交于 2019-12-07 07:41:25
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 ? I may be wrong, but this should do it: class PersonHandler(BaseHandler): model = Person fields = ('id', ('friends', ('id', 'name')), 'name') def read(self, request): return Person.objects.filter(...) You need to define a classmethod on the handler that returns the many-to-many data, I don't believe

“Invalid signature”: oAuth provider with Django-piston

為{幸葍}努か 提交于 2019-12-06 16:11:08
问题 I'm working with django-piston to attempt to create an API that supports oAuth. I started out using the tutorial at: http://blog.carduner.net/2010/01/26/django-piston-and-oauth/ I added a consumer to piston's admin interface with key and secret both set to "abcd" for test purposes. The urls are successfully wired-up and the oAuth provider is called. However, running my get request token tests with tripit (python get_request_token.py "http://127.0.0.1:8000/api" abcd abcd), I receive the

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

◇◆丶佛笑我妖孽 提交于 2019-12-06 01:33:30
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 error: descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode' Here is my handlers.py : from piston.handler import BaseHandler from lessons.models import NewEvent, EachEvent import calendar from datetime import datetime, timedelta class CalendarHandler(BaseHandler): allowed_methods = ('GET',) model = EachEvent fields = ('actualDate', (

Is django-piston mature enough?

China☆狼群 提交于 2019-12-05 22:47:22
问题 I'm developing an advertising site and want to use web services for the requests. I mean, a publisher site will put a JavaScript snippet and it will pull a banner through a REST GET. Is the django-piston framework mature enough to implement this functionality? 回答1: I am currently using it and it's good enough for my needs, which are fairly simple (mostly just an easy way to set up a read-only API for model data). I do have a couple of criticisms: It doesn't seem that jespern, the code's

“Invalid signature”: oAuth provider with Django-piston

匆匆过客 提交于 2019-12-04 21:25:37
I'm working with django-piston to attempt to create an API that supports oAuth. I started out using the tutorial at: http://blog.carduner.net/2010/01/26/django-piston-and-oauth/ I added a consumer to piston's admin interface with key and secret both set to "abcd" for test purposes. The urls are successfully wired-up and the oAuth provider is called. However, running my get request token tests with tripit (python get_request_token.py " http://127.0.0.1:8000/api " abcd abcd), I receive the following error: Invalid signature. Expected signature base string: GET&http%3A%2F%2F127.0.0.1%3A8000%2Fapi

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

时光总嘲笑我的痴心妄想 提交于 2019-12-04 11:30:19
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 a: [Tue Sep 06 11:29:46 2011] [error] [client 207.35.164.99] mod_wsgi (pid=820): Exception occurred processing WSGI script 'myscript.wsgi'. [Tue Sep 06 11:29:46 2011] [error] [client 207.35.164.99] IOError: failed to write data to appear in my server's error logs. I can "fix" the problem in the app by not explicitly closing the connection, but just

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

▼魔方 西西 提交于 2019-12-04 08:39:34
问题 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

Django RESTful API - django-piston vs. django-tastypie

梦想的初衷 提交于 2019-12-04 07:35:14
问题 We're looking for a general RESTful API solution for our Django project. We would use the API at first for Ajax calls on the web site and later for mobile apps, external apps and things like that. I found two modules which seem to be widely used. django-piston and django-tastypie From what I read, piston seems to be older and thus more mature but maybe a bit outdated?! While tastypie is relatively new and nicely documented. What would be the best thing to go with? django-piston or django

Is django-piston mature enough?

偶尔善良 提交于 2019-12-04 05:08:51
I'm developing an advertising site and want to use web services for the requests. I mean, a publisher site will put a JavaScript snippet and it will pull a banner through a REST GET. Is the django-piston framework mature enough to implement this functionality? I am currently using it and it's good enough for my needs, which are fairly simple (mostly just an easy way to set up a read-only API for model data). I do have a couple of criticisms: It doesn't seem that jespern, the code's creator, is doing much in response to issues posted to bitbucket . Possibly an unfair criticism, and activity in