Client-Side Web Programming
Libraries
[https://utidylib.berlios.de/ utidylib] and [https://www.egenix.com/files/python/mxTidy.html mxTidy] -- Python interfaces to [https://tidy.sourceforge.net/ html tidy] library to clean up HTML documents.
[https://www.crummy.com/software/BeautifulSoup/ BeautifulSoup] -- a permissive HTML parser.
Don't use [https://python.domainunion.de/doc/current/lib/module-HTMLParser.html HTMLParser] on HTML that might be invalid! That way lies pain. Either clean it up (using tidy), or use a different parser.
[https://python.domainunion.de/doc/current/lib/module-urllib.html urllib], [https://python.domainunion.de/doc/current/lib/module-urllib2.html urllib2], and [https://python.domainunion.de/doc/current/lib/module-httplib.html httplib] in the standard library.
[https://wwwsearch.sourceforge.net/ClientCookie/ ClientCookie], [https://wwwsearch.sourceforge.net/ClientForm/ ClientForm], and [https://wwwsearch.sourceforge.net/mechanize/ Mechanize] are higher-level libraries for writing a web client.