Example #1
0
def method(version, method):
    """Display the specified API method as an RSS feed."""
    params = dict(request.args)
    params.update({
        'filter': '-cMqQU)2Ngv7r(VTGLvhKZnEIDGH09-IxaIfPU3vLaIXPO*dlV0SQg3._npJh3Qj1ah(aRM8jjRvI_xG9OPgURzV(xF.qBi6I1C-r4h088reO*6s-cXlFwv0lvo2(n4o-CVp4K5XZtXS_jePvw2r4H',
        'key': config['key'],
    })
    data = requests.get('http://api.stackexchange.com/%s/%s' % (
        version,
        method,
    ), params=params).json()
    type_ = types[data['type']]
    feed = RSSFeed(
        'Stack2RSS Custom Feed',
        'A custom RSS feed for the "/%s" Stack Exchange API method.' % method
    )
    for i in data['items']:
        feed.append_item(**process_item(i, type_))
    return feed.get_xml()
Example #2
0
def method(version, method):
    """Display the specified API method as an RSS feed."""
    params = dict(request.args)
    params.update({
        'filter':
        '-cMqQU)2Ngv7r(VTGLvhKZnEIDGH09-IxaIfPU3vLaIXPO*dlV0SQg3._npJh3Qj1ah(aRM8jjRvI_xG9OPgURzV(xF.qBi6I1C-r4h088reO*6s-cXlFwv0lvo2(n4o-CVp4K5XZtXS_jePvw2r4H',
        'key': config['key'],
    })
    data = requests.get('http://api.stackexchange.com/%s/%s' % (
        version,
        method,
    ),
                        params=params).json()
    type_ = types[data['type']]
    feed = RSSFeed(
        'Stack2RSS Custom Feed',
        'A custom RSS feed for the "/%s" Stack Exchange API method.' % method)
    for i in data['items']:
        feed.append_item(**process_item(i, type_))
    return feed.get_xml()