How to use the feedgenerator.SimplerXMLGenerator function in feedgenerator

To help you get started, we’ve selected a few feedgenerator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rackerlabs / yagi / tests / unit / test_feed.py View on Github external
def test_write_item_in_cuf_feed(self):
        outfile = StringIO()
        handler = feedgenerator.SimplerXMLGenerator(outfile, 'utf-8')
        handler.startDocument()
        contents = ''
        item = {u'description': u'test', u'pubdate': None,
                u'author_link': None, u'author_name': None,
                u'link': 'http://127.0.0.1/test/some_uuid',
                u'ttl': None, u'enclosure': None, u'categories': [u'test'],
                u'item_copyright': None, u'title': u'test',
                u'author_email': None, u'comments': None,
                'contents': contents,
                u'unique_id': None}
        cuf_paged_feed = CufPagedFeed(title='test',
                                      link='http://127.0.0.1/test/some_uuid',
                                      feed_url='http://127.0.0.1/test/some_uuid',
                                      description='test',
github rackerlabs / yagi / yagi / serializer / atom.py View on Github external
def dump_item(entity, entity_links=True):
    """Serializes a single dictionary as an ATOM entry"""
    from StringIO import StringIO

    outfile = StringIO()
    handler = feedgenerator.SimplerXMLGenerator(outfile, 'utf-8')
    handler.startDocument()
    title = unicode(yagi.config.get('event_feed', 'feed_title'))
    feed = PagedFeed(
        title=title,
        link=_entity_url(),
        feed_url=_entity_url(),
        description=title,
        language=u'en',
        previous_page_url=None,
        next_page_url=None)

    _feed_entity(feed, entity, entity_links)
    feed.write_item(handler, feed.items[0], root=True)
    return outfile.getvalue()
github rackerlabs / yagi / yagi / serializer / cuf.py View on Github external
def dump_item(entity, service_title="Server"):
    """Serializes a single dictionary as an ATOM entry"""
    from StringIO import StringIO

    outfile = StringIO()
    handler = feedgenerator.SimplerXMLGenerator(outfile, 'utf-8')
    handler.startDocument()
    title = unicode(yagi.config.get('event_feed', 'feed_title'))
    feed = CufPagedFeed(
        title=title,
        link=_entity_url(),
        feed_url=_entity_url(),
        description=title,
        language=None,
        previous_page_url=None,
        next_page_url=None)

    event_type = unicode(entity['event_type'])
    original_message_id = unicode("original_message_id:{id}".format(id=
                                  entity['original_message_id']))
    feed.add_item(
        title=unicode(entity['event_type']),
github getpelican / feedgenerator / feedgenerator.py View on Github external
def write(self, outfile, encoding):
        handler = SimplerXMLGenerator(outfile, encoding)
        handler.startDocument()
        handler.startElement('feed', self.root_attributes())
        self.add_root_elements(handler)
        self.write_items(handler)
        handler.endElement("feed")