From 0c989327acb372ca47d6738662e24302ea69d6ed Mon Sep 17 00:00:00 2001 From: theo1 Date: Thu, 1 Oct 2020 18:59:46 +0200 Subject: [PATCH] adding corrected app.py without sensitive token --- app.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app.py diff --git a/app.py b/app.py new file mode 100644 index 0000000..24c563e --- /dev/null +++ b/app.py @@ -0,0 +1,22 @@ +from mastodon import Mastodon +from flask import Flask, request +from config import configObject + +# The Flask instance +app = Flask(__name__) + +mastodon = Mastodon( + access_token = configObject.ACCESS_TOKEN, + api_base_url = configObject.SERVER_NAME +) + +@app.route('/toot', methods = ['POST']) +def toot(): + if(request.method != 'POST'): + print('/toot/ : You should only POST on this path.') + return + toot_content = request.data + if(toot_content == None): + return "No content, aborting" + print(mastodon.status_post(toot_content, spoiler_text="Musique")) + return "Tooted !" \ No newline at end of file