[Tutor] python myspace module?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Oct 25 23:24:53 CEST 2005



On Tue, 25 Oct 2005, Ed Hotchkiss wrote:

> looking to write a myspace wrapper/module. what is the best way
> (hopefully using the stdlib not an outside module) to connect to a
> website and (if possible, otherwise ill have to code it?) access forms
> with GET POST blah blah blah ...

Hi Ed,

We do have some rudimentary access by using libraries like urllib and
urllib2.  Let's look at urllib for the moment:

    http://www.python.org/doc/lib/module-urllib.html

By default, it send GET queries, but if we pass in a data argument to its
open() function, it can perform a POST.  So for really quick-and-dirty
stuff, urllib can do the trick.


For anything more sophisticated, we may want to look at some tools like
mechanize:

    http://wwwsearch.sourceforge.net/mechanize/

which can help provide the illusion of a stateful session with a web
server.


Best of wishes!



More information about the Tutor mailing list