A library for parsing and validating rel-alternate-hreflang entries on a page.


Keywords
hreflang
License
Apache-2.0
Install
pip install polly==0.6.4

Documentation

Introduction

polly is a library to help you parse and check rel-alternate-hreflang annotations on a page.

Using polly you can fetch a page and quickly access information about how many rel-alternate-hreflang entries are on a page, and which countries and languages they cover:

my_page = PollyPage(initial_url)
print my_page.hreflang_values
print my_page.languages
print my_page.regions

You can also check various aspects of a page, see whether the pages it includes in its rel-alternate-hreflang entries point back, or whether there are entries that do not see retrievable (due to 404 or 500 etc. errors):

print my_page.is_default
print my_page.no_return_tag_pages()
print my_page.non_retrievable_pages()

Using polly

Simply install it with pip:

pip install polly

Included with polly is a small script for checking a URL:

python hreflang-check.py  "https://www.facebook.com/"

To Do

Why Polly?

Polyglot. Get it?!

Contributing

See CONTRIBUTING file.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License

See LICENSE file.