title: Python et cache J’ai eu plusieurs demandes techniques concernant [la mise en cache](/david/stream/2015/01/05/) des articles liés cette année. J’utilise la bibliothèque [readability-lxml](https://pypi.python.org/pypi/readability-lxml) de manière assez standard : :::python import requests from readability.readability import Document def extract_page(url): """From an URL, extract title and content. The title is shortened through the `short_title` method. The content doesn't contain `
` tags to be directly embeddable in the template and rendered as is. """ # Retrieves the resource and turns it into a doc. response = requests.get(url) document = Document(response.text, debug=True) # The short title is more concise and readable. title = document.short_title() content = document.summary(html_partial=True) # Removing the added