Readability Python API

Version 1.0.0

The official Python client library for the Readability Parser and Reader APIs.

Development of the readability-api package is hosted on Github. The package itself is hosted on PyPI and can easily be installed using pip.

Version 1.0.0 Notice

Version 1.0 and up have fundamentally changed the objects returned by calls to the API. The underlying requests.Response objects are returned which greatly increases transparency and ease of development.

This is a departure from the 0.x releases which provided wrapped objects and hid the http request mechanics. These releases also did not use the Requests library. Version 1.0 also transitions to using requests-oauthlib for oAuth support.

In addition, 1.x introduces python3 support (woohoo!)

Installation

pip install readability-api

Examples

Getting a user’s favorite bookmarks is easy.

from readability import ReaderClient

# If no client credentials are passed to ReaderClient's constructor, they
# will be looked for in your environment variables
client = ReaderClient(token_key="a user's key", token_secret"a user's secret")
bookmarks_response = client.get_bookmarks(favorite=True)

print(bookmarks_response.json())
>>> {'bookmarks': [{'user_id': 9999, 'read_percent': u'0.00', ... }

See readability.ReaderClient docs for a complete list of available functionality.

from readability import ParserClient

parser_client = ParserClient('your_parser_token')
parser_response = parser_client.get_article('http://paulgraham.com/altair.html')
article = parser_response.json()

print(article['title'])
>>> "What Microsoft Is this the Altair Basic of?"

print(article['content'])
>>> "<div><p>February 2015<p>One of the most valuable exercises you can try if you ..."

See readability.ParserClient docs for a complete list of available functionality.