Hello,

I am sorry for asking this, I know similar questions have been asked
before but I could not piece together the answer I needed from
previous contribution!

I have a view, for example:

@login_required
def clever_view(request):
    #Render a PDF to a string
    response = HttpResponse(content_type='application/pdf')
    response.write(pdf_as_string)
    return response

Now, in a browser, if I request http://my.host.name/clever_view.pdf I
get sent to the log in page, I log in, and I get my file. If I don't
log out I can later on request http://my.host.name/clever_view.pdf and
I get the file strait away. The browser handles the session and csrf
cookies perfectly.
For clarity, the login requires POST inputs 'username', 'password' and
the submit button is called 'submit'.

Now a client wants to use wget or curl to get the file:

wget http://my.host.name/clever_view.pdf

However, all I get are 403 even when I POST the username and password,
save the cookies and keep the session cookies.

So in short, how do I access a view when session and csrftoken cookies
are required.

If someone could show me an example of using curl or wget to access a
view that is not wrapped with @csrf_exempt but is wrapped with
@login_required I would be very grateful indeed.

Thanks in advance

Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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