I want to write a bash script that will notify me about changes on a trac wiki timeline. Unfortunately I can't "login" (it needs cookie for next logins).
wget http://someserver.com/trac/xxx/login \
--save-cookies=cookies --keep-session-cookies
wget http://someserver.com/trac/xxx/login \
--load-cookies=cookies \
--save-cookies=cookies.new --keep-session-cookies\
--post-data=user=viroos&password=myPassword
I get:
Error 400: Bad Request
I also tried --user --password options:
wget --no-check-certificate --user viroos --password myPassword\
https://someserver.com/trac/xxx/timeline?ticket=on&changeset=on&milestone=on&wiki=on&blog=on&max=50&daysback=90&format=rss
But this downloads only the login page.
What am I doing wrong?
I think you are very close to the solution. This should work depending on your configuration:
First call does the authorization on /login url and saves the auth cookie. The second call should get what you want.
This will work if you have basic autohrization enabled on ..../trac/login url.
The --user/--password flags in wget, for http URLs, cover HTTP basic authentication. Trac has its own login mechanism, so these flags won't work in this case.
There is a way to do what you want, (although I'm not sure wget is capable of doing it), but before spending time on that direction, did you consider using the TRAC timeline RSS feed?
The RSS feed will allow you to subscribe to the timeline changes, using your favorite RSS reader, and be notified of them. It will also give you a standard XML file for easy parsing, so you'll be able to do what you want with the data.