当前位置: 首页>>代码示例>>Python>>正文


Python Feed.title方法代码示例

本文整理汇总了Python中models.Feed.title方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.title方法的具体用法?Python Feed.title怎么用?Python Feed.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Feed的用法示例。


在下文中一共展示了Feed.title方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_feed_github

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
def add_feed_github(request, user=None):
#    if user is None:
#        return 'fail'


    if request.user.is_authenticated():

        user = request.REQUEST['user']
        url = 'https://github.com/%s/' % user
        feed_url = 'https://github.com/%s.atom' % user

    #    feed, create = Feed.objects.get_or_create(title=user)

        category, created = Category.objects.get_or_create(name='github', slug='github')

        feed = Feed()
        feed.title = user
        feed.url = url
        feed.category = category
        feed.feed_url = feed_url
        feed.dt_checked = datetime.datetime(1, 1, 1, 0, 0, 0)
        feed.dt_updated = datetime.datetime(1, 1, 1, 0, 0, 0)
        feed.save()

        return HttpResponse('yay')

#        return HttpResponseRedirect('/admin/reader/feed/%d/' % (feed.id,))
    else:
        return 'h4axx0r..'
开发者ID:peppelorum,项目名称:kod100,代码行数:31,代码来源:views.py

示例2: get_feed_from_url

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
def get_feed_from_url(url):
    """
    Download a rss 2.0 feed and returns a class which represents that feed.
    :param url: URL of the feed to download.
    :return: Feed
    """
    rss = get_rss_feed_parser(url)
    if not is_rss_feed_valid(rss):
        raise LookupError("Sorry! We cannot parse the rss feed. Missing required element(s).")
    feed = Feed()
    feed.title = rss["channel"]["title"]
    feed.link = rss["channel"]["link"]
    feed.description = rss["channel"]["description"]
    feed.image = FeedItemImage(
        url=rss["channel"]["image"]["url"],
        title=rss["channel"]["image"]["title"],
        link=rss["channel"]["image"]["link"],
        width=rss["channel"]["image"]["width"],
        height=rss["channel"]["image"]["height"],
    )
    feed.items = []
    for item in rss["items"]:
        feed.items.append(
            FeedItem(
                title=item["title"],
                link=item["link"],
                guid=item["guid"],
                pub_date=datetime.fromtimestamp(mktime(item["published_parsed"])),
            )
        )
    return feed
开发者ID:ouattararomuald,项目名称:can-endpoints,代码行数:33,代码来源:can_api.py

示例3: post

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
    def post(self):
        #表单字段: url, author, title, content, allow_sendto_kindle
        f = Feed()
        f.url = self.request.get('tUrl')
        f.title = self.request.get('tTitle')
        f.put(); # save

        return self.redirect('/feed')
开发者ID:tonychi,项目名称:readLater,代码行数:10,代码来源:main.py

示例4: add_rss

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
def add_rss(request, url=None):
    if url is None:
        url = request.REQUEST['url']
    d = feedparser.parse(url)
    feed = Feed()
    feed.title = d.feed.get('title', 'Untitled')
    feed.url = d.feed.get('link', url[:url.find('/', 8)])
    feed.feed_url = url
    feed.dt_checked = datetime.datetime(1, 1, 1, 0, 0, 0)
    feed.dt_updated = datetime.datetime(1, 1, 1, 0, 0, 0)
    feed.save()
    update(request, feed.id)
    return HttpResponseRedirect('/admin/reader/feed/%d/' % (feed.id,))
开发者ID:peppelorum,项目名称:kod100,代码行数:15,代码来源:views.py

示例5: add_feed

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
def add_feed():
    title = request.form.get('title')
    url = request.form.get('url')
    delay = request.form.get('delay')
    feed = Feed()
    feed.url = url
    feed.title = title
    feed.delay = delay
    feed.latest_fetch = datetime.datetime.now()
    feed.put()
    flash(u'KeyWord add successfully~', 'success')
    flush_feed_cache()
    return redirect(url_for("admin"))
开发者ID:abazad,项目名称:RSSNewsGAE,代码行数:15,代码来源:admin.py

示例6: init_gae

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import title [as 别名]
 def init_gae():
     f = Feed()
     f.url = 'http://money.163.com/special/00252EQ2/yaowenrss.xml'
     f.title = '要闻综合-网易财经'
     f.put()
开发者ID:lichenxi,项目名称:StockNewsGAE,代码行数:7,代码来源:controller.py


注:本文中的models.Feed.title方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。