#!/usr/bin/env python3 import flask from mastodon import Mastodon """ A little test, prototype for an experimental Mastodon interface, using the Mastodon API through the Mastodon.py library. """ def get_timeline(): mastodon = Mastodon( client_id = 'api_clientcred.secret', api_base_url = 'https://post.lurk.org' ) timeline = mastodon.timeline_local(max_id=None, since_id=None, limit=40) # timeline = mastodon.timeline_public(max_id=None, since_id=None, limit=40, only_media=False) instance = mastodon.instance() return timeline, instance # Create the Flask application. APP = flask.Flask(__name__) @APP.route('/', methods=['GET']) def index(): """ Displays the index page accessible at '/' """ content, instance = get_timeline() html = flask.render_template('index.html', content=content, instance=instance) return html if __name__ == '__main__': APP.debug=True APP.run(port=5000)