Web Browser Programming in Python
Embedding Python inside Web Browsers
- This section describes projects where the python interpreter itself can and has been embedded into the web browser. Instead of downloading the standard python executable and libraries, these projects come with the python runtime and libraries pre-embedded (and, as such, are typically very large downloads).
Python wrappers around Web "Libraries" and Browser Technology
- This section describes projects where you can (or have to) create your own web browser application in python. It includes web browser "engines" that have python interfaces to access, control and present web pages and web-relevant rich media content (such as Adobe Flash).
PyWebKitGtk - PyWebkitGtk is a python wrapper around Webkit that embeds the Webkit "engine" as a GTK widget. The standard version of pywebkitgtk is unable to provide access to the DOM model, treating pywebkit as a hands-off widget that can be used to write your own Web Browser (see demobrowser.py). However, a patch to webkit and a corresponding patch to pywebkitgtk will soon bring DOM model manipulation to python: see PyjamasDesktop for details.
PyWebkitQt4 is a python wrapper again around Webkit but this time as a Qt4 widget. Bindings to the DOM model have not been added to PyWebkitQt4, and so you can only use PyWekitQt4 to create your own web browser, rather than manipulate the DOM model content itself.
PyKDE - KDE contains python bindings to KHTMLPart (which is very similar to Webkit). This allows you to embed HTML into an application window. The Python bindings to the DOM model are slightly... obtuse. to say the least, and PyKHTML - PyKHTML makes them much more tolerable (see dom.py). However, there are limitations in PyKDE's DOM bindings (that many people will never encounter) that you should investigate thoroughly before utilising PyKDE for seriously heavy-duty DOM model manipulation.
Webkit with the ObjectiveC bindings (MacOSX users only). Webkit itself has ObjectiveC bindings, on MacOSX. MacOSX's ObjectiveC technology comes with automatic bindings to all major programming languages, including python. Consequently, you can directly manipulate the DOM model from python.
HulaHop provides python access to DOM model manipulation - via XUL / Gecko Interfaces. HulaHop is part of the OLPC Sugar Project, but is available stand-alone. It depends on pydom (part of XULrunner).