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


Python Feed.url方法代码示例

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


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

示例1: add_feed_github

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import url [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: post

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import url [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

示例3: add_rss

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import url [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

示例4: add_feed

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import url [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

示例5: init_gae

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import url [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.url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。