Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Modularly extensible semantic metadata validator
HTML Web Ontology Language Python


Schemato is a validator for HTML-embedded metadata standards. It knows the location of the official schema definitions, and uses these documents as validation templates. As a contributor, you can easily subclass the base validator class to plug into this functionality.

To see the validator in action:

from schemato import Schemato
sc = Schemato("my_test.html")
res = sc.validate()
[a.to_dict() for a in res]

The first time you run schemato, it will make requests for the latest versions of the official schema definitions. Schemato will then call the validate() method of the Validator subclasses listed in

There are a few test documents available for validation in the test_documents subdirectory.


Download the source from PyPI with

pip install schemato

You can also clone this repo and take a closer look at the code and test documents

git clone

Then, install the library with

python install


To run the tests for Schemato:

pip install pytest
cd schemato


Schemato's distiller framework lets you implement strategies for creating a "normalized" set of metadata by mixing and matching metadata from different supported standards.

Supported so far:

* parsely-page
* OpenGraph
* NewsArticle

Take a look at the clean Python class definitions that describe the strategies:

There are two examples -- one that tries pp and falls back on (called ParselyDistiller) and another the tries and falls back on OpenGraph (called NewsDistiller).

The distiller returns a clean Python dictionary that has all the extracted fields, as well as a dictionary describing which metadata standard was used to source each field. The framework is defined here:

Here is an example of usage:

>>> from schemato import Schemato
>>> from schemato.distillery import ParselyDistiller, NewsDistiller
>>> mashable = Schemato("")
>>> ParselyDistiller(mashable).distill()
{'author': u'Seth Fiegerman',
'image_url': u'',
'link': u'',
'page_type': u'post',
'post_id': u'1432059',
'pub_date': u'2012-10-17T11:36:40+00:00',
'section': u'bus',
'site': 'Mashable',
'title': u"Apple's Manufacturing Partner Explains iPhone 5 Supply Problems"}

In this case, Mashable implements the parsely-page metadata field, which is used to source all the defined properties for this distiller.

>>> d = NewsDistiller(mashable)
>>> d.distill()
{'author': None,
'id': None,
'image_url': '',
'link': '',
'pub_date': None,
'section': None,
'title': "Apple's Manufacturing Partner Explains iPhone 5 Supply Problems"}
>>> d.sources
{'author': None,
'id': None,
'image_url': 'og:image',
'link': 'og:url',
'pub_date': None,
'section': None,
'title': 'og:title'}

In this case, our strategy did not involve parsely-page, and instead used and OpenGraph. Since Mashable does not implement but does implement OpenGraph, it comes up with the fields it can. The sources property shows which fields were populated and how they got their values.


If you need help using Schemato, or have found a bug, please create an issue on the Github repo.

Something went wrong with that request. Please try again.