Re: curl pages behind login_required

2011-05-08 Thread Jacob Kaplan-Moss
On Sun, May 8, 2011 at 3:17 PM, CarlFK  wrote:
> I am trying to curl pages that require being logged in via django's
> default auth.  I don't care if the actual login is done with curl,
> python, firefox or whatever is easiest.

Are you wedded to curl for the download? If it were me, I'd use
something like Mechanize (http://wwwsearch.sourceforge.net/mechanize/)
which can handle logging in, storing cookies, and doing the download.

Jacob

-- 
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.



Re: curl pages behind login_required

2011-05-08 Thread Shawn Milochik
And just to be clear, I wasn't saying go away. I think you can authenticate
completely in curl. If not you can in wget.

-- 
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.



Re: curl pages behind login_required

2011-05-08 Thread Shawn Milochik
Do a Google search on using cookies in curl.
On May 8, 2011 4:17 PM, "CarlFK"  wrote:
> I am trying to curl pages that require being logged in via django's
> default auth. I don't care if the actual login is done with curl,
> python, firefox or whatever is easiest.
>
> This only works sometimes, so I am missing something:
>
> install https://addons.mozilla.org/en-us/firefox/addon/export-cookies/
> ./manage.py runserver
> browse FF to http://localhost:8080/admin/
> log in
> FF tools/export cookies/cookeis.txt
> $ grep localhost cookies.txt
> localhost FALSE / FALSE 1306094671 sessionid
> 754305fdac240f1ab68371b1f860eaa0
> localhost FALSE / FALSE 1336334661 csrftoken
> 4fa9c0c4f6cb537df8389fb63df61f3b
>
> $ curl -s --cookie sessionid=754305fdac240f1ab68371b1f860eaa0
> http://localhost:8080/admin/ | grep "Log out"
> Log out
>
> good - you only get "Log out" if you are logged in. So that works.
>
> When I try it with the production site (log in, save cookes, grep
> hostname use that session id...), I get the login form html, meaning
> it isn't seeing me as logged in.
>
> --
> 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.
>

-- 
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.