def sources_post(): feed_url = request.form['feed'] parsed = feed.parse(feed_url) feed_source = feed.get_source(parsed) source = FeedSource.insert_from_feed(feed_url, feed_source) feed_articles = feed.get_articles(parsed) Article.insert_from_feed(source.sid, feed_articles) return redirect('/sources')
async def rss_data(feed_input: feed_input): f = feed.parse(feed_input.url) return f
def test_parse(): assert feed.parse('https://weather.gc.ca/rss/city/on-149_e.xml') != None
def update_source(src): parsed = feed.parse(src.feed) feed_articles = feed.get_articles(parsed) article.Article.insert_from_feed(src.id, feed_articles) print('Updated '+ src.feed)
def sources_post(): feed_url = request.form['feed'] parsed = feed.parse(feed_url) feed_source = feed.get_source(parsed) source = Source.insert_from_feed(feed_url, feed_source) return redirect('/sources')