Updates python to update tags on owncast server

- removes the nsfw tag function
- adds functionality to the tags update endpoint to process raw data
  from client
This commit is contained in:
Ariana Giroux 2022-08-04 17:41:40 -06:00
parent ea96df1774
commit 03f2f966d7
1 changed files with 8 additions and 14 deletions

22
app.py
View File

@ -105,25 +105,19 @@ def updateStreamTitle():
@app.route('/api/update/servertags', methods=['POST'])
def updateServerTags(tags_list: list):
def updateServerTags():
""" An endpoint to allow the user to update the stream title.
:returns: the status code of the post request made to the server.
"""
values = [i.strip() for i in request.get_json(force=True).split(',')]
response = session.post(
stream_data['stream_url'] + '/api/admin/config/tags',
data=json.dumps({
'value': tags_list
'value': values
})
)
return response.status_code, json.loads(response.text)
@app.route('/api/update/nsfw', methods=['POST'])
def updateServerNSFW(boolean: bool):
response = session.post(
stream_data['stream_url'] + '/api/admin/config/nsfw',
data=json.dumps({
'value': boolean
})
)
return response.status_code, json.loads(response.text)
return Response(status=response.status_code)
@app.route("/")