views:

89

answers:

3

I use several ad networks for my sites, and to see how much money I made I need to log in to each daily to add up the values. I was thinking of making a Python script that would do this for me to get a quick total. I know I need to do a POST request to log in, then store the cookies that I get back and then GET request the report page while passing in those cookies.

What's the most convenient way to replicate in Python what I'm doing when I browse the sites manually?

+3  A: 

See if this work for you:

http://stockrt.github.com/p/emulating-a-browser-in-python-with-mechanize/

Jeremy Cantrell
A: 

cookielib does client-side cookie handling, and mechanize enhances it in several ways -- including a way to initialize a cookie jar by reading the cookies from an Internet Explorer cache (so, if you can log in manually once to each site on Windows, you can then use cookielib or mechanize for future logins based on exactly the same cookies -- until they expire of course).

Alex Martelli
+1  A: 

not a Python solution, but consider using a browser automation tool like Chickenfoot.

Plumo
+1 wow, never heard of this extension... interresting
Diego Castro