snowplow/referer-parser — pull request #3 by donspaulding (2012-12-24 18:37:57+00:00)
Title: Python port

Ported the referer-parser library to Python.

Usage seems similar to the Ruby API, while trying to remain idiomatic to Python development.

The `uri` attribute that is available on the parsed `Referer` instance, holds the return value of python's `urlparse` function. As such, it differs from the `uri` attribute of the Ruby API. For instance, instead of getting the domain name by traversing `r.uri.host` the developer must traverse `r.uri.netloc`. All the other attributes are derived from this one, and the `urlparse` module is well documented and familiar to many python developers.

The biggest difference between this port and the others is that it relies on the search.yml file being converted to search.json. Python's standard library doesn't include a YAML parser, but it does have a JSON parser. YAML could be listed as a dependency in setup.py, but it seemed better to me to increase the burden on the distributor of the python package instead of increasing the run-time dependencies for any who would use the package. To that end, the distribution process for python looks like this:

1. `./sync_yaml.sh`
2. `python/build_json.py`.
3. `python setup.py sdist bdist_wininst upload`

I've taken the liberty to upload the port to PyPI so that it can be installed via the traditional `pip install foo` method. I've also updated the main README.md to summarize usage of the Python port.