本文整理匯總了Python中feed.Feed.to_json方法的典型用法代碼示例。如果您正苦於以下問題:Python Feed.to_json方法的具體用法?Python Feed.to_json怎麽用?Python Feed.to_json使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類feed.Feed
的用法示例。
在下文中一共展示了Feed.to_json方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: country_articles
# 需要導入模塊: from feed import Feed [as 別名]
# 或者: from feed.Feed import to_json [as 別名]
def country_articles(country=None):
from feed import Feed
country=country.encode('ascii', 'ignore')
country=country.replace("Dem.", "Democratic")
country=country.replace("Rep.", "Republic")
country=country.replace("W.", "West")
country=country.replace("Lao PDR", "Laos")
country=country.replace("Bosnia and Herz.", "Bosnia and Herzegovina")
country=country.replace("Eq. Guinea", "Equatorial Guinea")
country=country.replace("Cte d'Ivoire", "Ivory Coast")
country=country.replace("Fr. S. Antarctic Lands", "French Southern and Antarctic Lands")
country=country.replace("Is.", "Islands")
country=country.replace("S. Sudan", "South Sudan")
country=country.replace(" ", "_")
print country
url1="http://api.feedzilla.com/v1/categories/19/articles/search.atom?q="+country+"&count=50"
feed = Feed(url1)
# url2="http://api.feedzilla.com/v1/categories/26/articles/search.atom?q="+country+"&count=10"
# feed.add_feed(url2)
# feed = Feed()
# feed.load()
# feed.filter_country(country)
feed.extract()
return feed.to_json()
示例2: articles
# 需要導入模塊: from feed import Feed [as 別名]
# 或者: from feed.Feed import to_json [as 別名]
def articles():
from feed import Feed
# feed = Feed('data/2014-04-05_16-54.atom')
feed = Feed()
feed.load()
return feed.to_json()