コード例 #1
0
from readnext import app

app.run(host='0.0.0.0', debug=True)
コード例 #2
0
ファイル: runserver.py プロジェクト: lvgelder/gu-venues
from readnext import app
app.run(host='0.0.0.0', debug=True)
コード例 #3
0
ファイル: views.py プロジェクト: voodoochild/gu-read-next
            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)
コード例 #4
0
            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)