来自站点的数据 http://www.case-parts.com对我来说是必要的。 为了获取这些数据,我打算使用 RSS。所有商品目录对我来说都是必需的,但是在 RSS ( http://www.case-parts.com/catalog.html ) 中,我设法只接收有关站点上最后到达的信息。如何接收所有目录?
最佳答案
Django 提供联合作为框架的一部分。您可以阅读更多相关信息 here
基本上,您创建一个类并定义提要。 (本例来自django)
class LatestEntriesFeed(Feed):
title = "Chicagocrime.org site news"
link = "/sitenews/"
description = "Updates on changes and additions to chicagocrime.org."
def items(self):
return NewsItem.objects.order_by('-pub_date')[:5]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description
# item_link is only needed if NewsItem has no get_absolute_url method.
def item_link(self, item):
return reverse('news-item', args=[item.pk])
关于python - Django 的 RSS 解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15900883/