This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Caveman is a package that parses and validates HTML5 cache manifests. HTML5 applications are notoriously picky about their cache manifests, and it is difficult to check that all of the components are as they should be.

Caveman provides one command-line script, check_manifest, which pulls an HTML page, scrapes it for used resources, parses its cache manifest, and validates the resources against the manifest:

$ check_manifest URL

Problems with the manifest are written to the standard output. More detail about the process is output if you set the log level to a different severity with the –level=LEVEL switch, where LEVEL is DEBUG, INFO, WARNING, or ERROR.

Programmatic use

Caveman has been designed to be usable from your own code, for example, as part of a larger validation process, or as part of unit tests in your web application.

Caveman’s work is done by the ManifestChecker class. You instantiate it with two helpers: a get_url function that fetches data from URLs, and a logger object that gets logged messages:

from caveman import ManifestChecker

def get_url(url): ...

logger = ...

man_checker = ManifestChecker(get_url=get_url, logger=logger)

Then call its check_manifest method with the URL of the HTML page:

man_checker.check_manifest(url)

No value is returned: the output has been logged to the logger object. See the docstrings in the source code for details.

Django unit tests

As an example of programmatic use, here’s one way to use Caveman in a Django test suite:

from caveman import ManifestChecker

class TestManifest(django.test.TestCase):
    def setUp(self):
        self.checker = ManifestChecker(get_url=self.get_url, logger=self)
        self.caveman_log = []

    def get_url(self, url):
        """A get_url function for `caveman.ManifestChecker`."""
        # Use the Django test client to fetch the URL.
        response = self.client.get(url)
        return response.status_code, response.content, response

    # Record the serious Caveman messages in `self.caveman_log`.
    def debug(self, msg):       pass
    def info(self, msg):        pass
    def warning(self, msg):     self.caveman_log.append(msg)
    def error(self, msg):       self.caveman_log.append(msg)

    def test_my_manifest(self):
        """Caveman produces no warnings or errors for the cache manifest."""
        self.checker.check_manifest("/")
        self.assertEqual([], self.caveman_log)

Limitations

Caveman only pulls the HTML page you specify. Although it validates links to other HTML pages against the manifest, it does not pull those linked-to pages and verify their resources.

Certain rules from the HTML5 spec are not validated.

More information

Caveman can be downloaded from PyPI: http://pypi.python.org/pypi/caveman

The HTML5 cache manifest spec is at http://www.w3.org/TR/html5/offline.html

Docs at http://nedbatchelder.com/code/caveman.

Code repository and issue tracker are at bitbucket.org.

Release History

Release History

1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0b1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
caveman-1.0.tar.gz (6.1 kB) Copy SHA256 Checksum SHA256 Source Nov 16, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting