#!/usr/bin/env python """Client-side HTML processing with JavaScript support. DOMForm is a Python module for web scraping and web testing. It knows how to evaluate embedded JavaScript code in response to appropriate events. DOMForm supports both the ClientForm HTML form interface and the HTML DOM level 2 interface (note that ATM the DOM is written to an out-of-date version of the specification, and has some hacks to get it to work with 'DOM as deployed'). The ClientForm interface makes it easy to parse HTML forms, fill them in and return them to the server. The DOM interface makes it easy to get at other parts of the document, and makes JavaScript support possible. The ability to switch back and forth between the two interfaces allows simpler code than would result from using either interface alone. DOMForm is partly derived from several third-party libraries. JavaScript support currently depends on Mozilla's GPLed spidermonkey JavaScript interpreter (which is available separately from Mozilla itself) and python-spidermonkey. """ from DOMForm import VERSION NAME = "DOMForm" PACKAGE = True LICENSE = "BSD" PLATFORMS = ["any"] CLASSIFIERS = """\ Development Status :: 3 - Alpha Intended Audience :: Developers Intended Audience :: System Administrators License :: OSI Approved :: BSD License Natural Language :: English Operating System :: OS Independent Programming Language :: Python Topic :: Internet Topic :: Internet :: WWW/HTTP Topic :: Internet :: WWW/HTTP :: Browsers Topic :: Internet :: WWW/HTTP :: Dynamic Content Topic :: Internet :: WWW/HTTP :: Site Management Topic :: Internet :: WWW/HTTP :: Site Management :: Link Checking Topic :: Software Development :: Libraries Topic :: Software Development :: Libraries :: Python Modules Topic :: Software Development :: Testing Topic :: Software Development :: Testing :: Traffic Generation Topic :: System :: Networking :: Monitoring Topic :: System :: Systems Administration Topic :: Text Processing :: Markup Topic :: Text Processing :: Markup :: HTML Topic :: Text Processing :: Markup :: XML """ #------------------------------------------------------- # the rest is constant for most of my released packages: # ...but this is hacked slightly because there are sub-packages import sys, string from distutils.core import setup _setup = setup def setup(**kwargs): if not hasattr(sys, "version_info") or sys.version_info < (2, 3): # Python version compatibility # XXX probably download_url came in earlier than 2.3 for key in ["classifiers", "download_url"]: if kwargs.has_key(key): del kwargs[key] ## # Only want packages keyword if this is a package, ## # only want py_modules keyword if this is a single-file module, ## # so get rid of packages or py_modules keyword as appropriate. ## if kwargs["packages"] is None: ## del kwargs["packages"] ## else: ## del kwargs["py_modules"] apply(_setup, (), kwargs) ## if PACKAGE: ## packages = [NAME] ## py_modules = None ## else: ## py_modules = [NAME] ## packages = None doclines = string.split(__doc__, "\n") setup(name = NAME, version = VERSION, license = LICENSE, platforms = PLATFORMS, classifiers = filter(None, string.split(CLASSIFIERS, "\n")), author = "John J. Lee", author_email = "jjl@pobox.com", description = doclines[0], url = "http://wwwsearch.sourceforge.net/%s/" % NAME, download_url = ("http://wwwsearch.sourceforge.net/%s/src/" "%s-%s.tar.gz" % (NAME, NAME, VERSION)), long_description = string.join(doclines[2:], "\n"), ## py_modules = py_modules, ## packages = packages, packages = ["DOMForm", "DOMForm.dom", "DOMForm.dom.html"] )