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


Python MFeedPage.get_data方法代码示例

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


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

示例1: fetch_image_from_page_data

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
 def fetch_image_from_page_data(self):
     image = None
     image_file = None
     if self.page_data:
         content = self.page_data
     elif settings.BACKED_BY_AWS.get('pages_on_s3') and self.feed.s3_page:
         key = settings.S3_PAGES_BUCKET.get_key(self.feed.s3_pages_key)
         compressed_content = key.get_contents_as_string()
         stream = StringIO(compressed_content)
         gz = gzip.GzipFile(fileobj=stream)
         try:
             content = gz.read()
         except IOError:
             content = None
     else:
         content = MFeedPage.get_data(feed_id=self.feed.pk)
     url = self._url_from_html(content)
     if not url:
         try:
             content = requests.get(self.feed.feed_link).content
             url = self._url_from_html(content)
         except (AttributeError, SocketError, requests.ConnectionError,
                 requests.models.MissingSchema, requests.sessions.InvalidSchema,
                 requests.sessions.TooManyRedirects,
                 requests.models.InvalidURL,
                 requests.models.ChunkedEncodingError,
                 requests.models.ContentDecodingError,
                 LocationParseError, OpenSSLError, PyAsn1Error), e:
             logging.debug(" ---> ~SN~FRFailed~FY to fetch ~FGfeed icon~FY: %s" % e)
开发者ID:stevenatwork,项目名称:NewsBlur,代码行数:31,代码来源:icon_importer.py

示例2: fetch_image_from_page_data

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
 def fetch_image_from_page_data(self):
     image = None
     image_file = None
     if self.page_data:
         content = self.page_data
     # Deleted By Xinyan Lu : No S3 storage
     # elif settings.BACKED_BY_AWS.get('pages_on_s3') and self.feed.s3_page:
     #     key = settings.S3_PAGES_BUCKET.get_key(self.feed.s3_pages_key)
     #     compressed_content = key.get_contents_as_string()
     #     stream = StringIO(compressed_content)
     #     gz = gzip.GzipFile(fileobj=stream)
     #     try:
     #         content = gz.read()
     #     except IOError:
     #         content = None
     else:
         content = MFeedPage.get_data(feed_id=self.feed.pk)
     # Modified By Xinyan Lu : content may be None
     if content:
         url = self._url_from_html(content)
     else:
         url = None
     if url:
         image, image_file = self.get_image_from_url(url)
     return image, image_file, url
开发者ID:carlchen0928,项目名称:rssEngine,代码行数:27,代码来源:icon_importer.py

示例3: fetch_image_from_page_data

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
 def fetch_image_from_page_data(self):
     image = None
     image_file = None
     content = MFeedPage.get_data(feed_id=self.feed.pk)
     url = self._url_from_html(content)
     if url:
         image, image_file = self.get_image_from_url(url)
     return image, image_file, url
开发者ID:AnushPrem,项目名称:NewsBlur,代码行数:10,代码来源:icon_importer.py

示例4: load_feed_page

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
def load_feed_page(request, feed_id):
    if not feed_id:
        raise Http404
        
    data = MFeedPage.get_data(feed_id=feed_id)

    if not data:
        data = "Fetching feed..."
    
    return HttpResponse(data, mimetype='text/html')
开发者ID:mrcrabby,项目名称:NewsBlur,代码行数:12,代码来源:views.py

示例5: load_feed_page

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
def load_feed_page(request):
    feed_id = int(request.GET.get('feed_id', 0))
    if feed_id == 0:
        raise Http404
        
    data = MFeedPage.get_data(feed_id=feed_id)

    if not data:
        data = "Fetching feed..."
    
    return HttpResponse(data, mimetype='text/html')
开发者ID:francois2metz,项目名称:NewsBlur,代码行数:13,代码来源:views.py

示例6: load_feed_page

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
def load_feed_page(request):
    feed_id = None
    try:
        feed_id = int(request.REQUEST.get('feed_id', 0))
    except ValueError:
        feed_id_matches = re.search(r'(\d+)', request.REQUEST['feed_id'])
        if feed_id_matches: feed_id = int(feed_id_matches.group(1))
    if not feed_id:
        raise Http404
        
    data = MFeedPage.get_data(feed_id=feed_id)

    if not data:
        data = "Fetching feed..."
    
    return HttpResponse(data, mimetype='text/html')
开发者ID:rkabir,项目名称:NewsBlur,代码行数:18,代码来源:views.py

示例7: fetch_image_from_page_data

# 需要导入模块: from apps.rss_feeds.models import MFeedPage [as 别名]
# 或者: from apps.rss_feeds.models.MFeedPage import get_data [as 别名]
 def fetch_image_from_page_data(self):
     image = None
     image_file = None
     if self.page_data:
         content = self.page_data
     elif settings.BACKED_BY_AWS.get('pages_on_s3') and self.feed.s3_page:
         key = settings.S3_PAGES_BUCKET.get_key(self.feed.s3_pages_key)
         compressed_content = key.get_contents_as_string()
         stream = StringIO(compressed_content)
         gz = gzip.GzipFile(fileobj=stream)
         content = gz.read()
     else:
         content = MFeedPage.get_data(feed_id=self.feed.pk)
     url = self._url_from_html(content)
     if url:
         image, image_file = self.get_image_from_url(url)
     return image, image_file, url
开发者ID:alliepape,项目名称:NewsBlur,代码行数:19,代码来源:icon_importer.py


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