Python Scripts to logon to websites

Mike Meyer mwm at mired.org
Wed Jan 11 16:58:09 EST 2006


"BartlebyScrivener" <rpdooling at gmail.com> writes:
> New to Python and Programming. Trying to make scripts that will open
> sites and automatically log me on.

A common enough things to want to do.

> The following example is from the urllib2 module.
>
> What are "realm" and "host" in this example.

Host is a domain name that can be mapped to a ip address. Realm is
from HTTP authentication schemes. When the server asks for
authentication, it gives out a "realm" name as well, so that different
parts of the host can use different authentication systems.

> Does anyone have a simple example of a script that opens, say, gmail or
> some other commonly accessed site that requires a username and password
> so that I can see how one is made?

Yes, but its not clear how much good it'll do you. As Peter indicated,
not everyone uses HTTP based authentication. In fact, pretty much
anyone who wants to control how the authentication boxes look (which
seems to be 99% of the people writing web apps, never mind that they
can't really do that) use something other than HTTP-based
authentication. How you go about dealing with such sites depends on
where they put the user name/login information,and how they encode the
fact that you've authenticated as user "xxxx".

So I could show you my script for accessing yahoo. However, it
probably won't work on another site without changes to accomodate the
other site.

      <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list