Hi

I have problems to post some json data from a python script using *requests* 
to a django view defined as base classed view.
Thinking that problem is with permissions I also installed django rest 
framework to temporary allow any user to call the view.

the file with post data is looking like:

data = {'k1': 'val1', 'k2': 'val2'}
jdata = json.dumps(data)
r = requests.post(url, data=jdata, headers=headers)
print r

and the correspondign class based view registrated in urls.py:

class LoadData(APIView):

    """
    A view that can accept POST requests with JSON content.
    """
    parser_classes = (JSONParser,)
    permission_classes = (AllowAny,)

    def post(self, request, format=None):
        # pdb.set_trace()

now the method post will be not executed.
When I use *put* method instead of *post* the situation is better but also 
without data
in request.data or args, kwargs.

I used many times jQuery with ajax and post method in similar cases and it 
was always working,
so I have no idea what is the difference and what I am missing.

Any hint will be very appreciated and thanks in advance.
Ogi



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/534487cb-1677-4cdf-bf2e-2222579f3c0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to