Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:50:33+00:00 2026-05-16T05:50:33+00:00

I had django-piston working a week ago but recently I’m unable to call any

  • 0

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’. I’m assuming I can’t do request.data because the content type is null?

So, here is my simple web service:

class testHandler(BaseHandler):
     def create(self, request):
         if request.content_type:
              return 'yes'
         else:
              data = request.data
              return 'no'

And here is the urls.py file:

class CsrfExemptResource( Resource ):
     def __init__( self, handler, authentication = None ):
         super( CsrfExemptResource, self ).__init__( handler, authentication )
         self.csrf_exempt = getattr( self.handler, 'csrf_exempt', True )

controller_handler = CsrfExemptResource(controllerHandler)
test_handler = CsrfExemptResource(testHandler)

urlpatterns = patterns('',
     url(r'^controller/', controller_handler),
     url(r'^test/', test_handler),
)

And finally the code I run from my python terminal to call the service:

params = urllib.urlencode({'value':'someValue'}) 
req = urllib2.Request("http://127.0.0.1/cindy/api/test/", params) 
result = urllib2.urlopen(req).read() 

So ‘result’ always return no, and if I put the line ‘request.data’ in the service I get a HTTP 500 error.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:50:34+00:00Added an answer on May 16, 2026 at 5:50 am

    I don’t think there is a data attribute in the HttpRequest object. You might be looking for raw_post_data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've had the admin site working for my django app before but now I
I'm starting with Django. I had some site set up with SQLite working but
Anyone had any problems with installing django 1.3 and 1.4 on the same development
I have had many problems in Django (not all of them solved), but this
I had done this with markdown before following the book practical django projects but
I posted this question on the django-users list, but haven't had a reply there
I was looking if Django had some kind of create_or_get method but it seems
I had my website running in django local environment and it was working fine....
I've had plenty of experience in Django but I'm very new to the admin
I had no issue with Django + uWSGI + Cherokee. BUt I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.