This is intended not to be protected by auth, so this page is publicly
accessible, no login required.

Here's the function in its entirety:

255 @csrf_response_exempt
256 def DistroHeySpreadListener(request):
257         if request.method == 'POST':
258                 post = request.POST
259                 raw = request.raw_post_data
260                 remote_media_id = post.get("video_id", "")
261                 # Try to fetch the distros for this
remote_media_id
262                 distro_list =
Distro.objects.filter(remote_media_id__exact=remote_media_id)
263
264                 # Make sure there's at least one
265                 if len(distro_list) < 1:
266                         raise Http404
267
268                 # For each distro instance, check to see if
there's a response in this api call
269                 for distro in distro_list:
270                         # Prepare logging
271                         log = distro.log
272                         log += "Raw data from POST" + str(raw)
273                         distro.log = log
274                         distro.save()
275
276                         # Get distro short name
277                         dest_short_name =
distro.credential.destination.short_name
278
279                         # From short_name, return either error or
link starting with http://
280                         response = post.get('link[%s]' %
dest_short_name, False) or post.get('error[%s]' % dest_short_name,
False)
281
282                         if response.startswith('http://'):
283                                 # If response starts with http
then success, populate as link
284                                 distro.destination_url = response
285                                 distro.state = TRANSCODE_SUCCESS
286                                 log += '\nSUCCESS, url = %s' %
response
287                         else:
288                                 # Else, change state to error and
log error message
289                                 log += '\nERROR, error = %s' %
response
290                                 distro.state = TRANSCODE_ERROR
291
292                         distro.log = log
293                         distro.save()
294
295
296                 h = HttpResponse("Thanks, HeySpread! We love
you.", mimetype="text/plain", status=200)
297                 h.csrf_exempt = True
298                 return h
299 #               return HttpResponse("Thanks, HeySpread! We love
you.", mimetype="text/plain", status=200)
300         else:
301                 return HttpResponse("Oops, something went wrong.",
mimetype="text/plain", status=200)


On Jul 27, 11:30 am, raj <rajeeshrn...@gmail.com> wrote:
> Most probably it has something to do with permissions. Go thru the
> exact code block which tries to post the data. Is the login successful
> and does the logged-in user have got all necessary permissions
> required? Post that part of the code if you can't find out.
>
> Rajeesh.
>
> On Jul 27, 11:20 pm, Kieran Farr <kieran.f...@gmail.com> wrote:
>
>
>
> > Further, debugging 403s is nearly impossible. It'd be very helpful
> > when in DEBUG mode to reveal who/what/why raised the 403.
>
> > > What am I doing wrong/missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to