adding corrected app.py without sensitive token

This commit is contained in:
theo1 2020-10-01 18:59:46 +02:00
parent b0f832b933
commit 0c989327ac

22
app.py Normal file
View File

@ -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 !"