from readnext import app app.run(host='0.0.0.0', debug=True)
items = [] i = 0 for entry in soup.findAll('item'): if i < app.config['ITEMS_PER_FEED']: items.append(self.build_item(entry)) i = i + 1 else: break return items return False def build_item(self, data): """Transform RSS data into a dictionary that the template can use.""" article = { 'title': data.title.contents[0], 'url': data.link.contents[0], } media = data.findAll('media:content') for m in media: try: if m['width'] == u'140' and m['height'] == u'84': article['thumbnail'] = m['url'] except KeyError: pass return article if __name__ == "__main__": app.run(debug=True)