Merge pull request #8 from trwnh/patch-3

Fix: Change POST to GET for certain API calls
This commit is contained in:
Lili (Lin) Pavelů 2022-12-05 11:23:12 +01:00 committed by GitHub
commit 9c0e709c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -6,14 +6,14 @@ from sqlite3 import Error
# # # requests stuff # # # # # # requests stuff # # #
def is_stream_live(): def is_stream_live():
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/status' url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/status'
r = requests.post(url) r = requests.get(url)
return r.json()["online"] return r.json()["online"]
def give_points_to_chat(db): def give_points_to_chat(db):
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/integrations/clients' url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/integrations/clients'
headers = {"Authorization": "Bearer " + current_app.config['OWNCAST_ACCESS_TOKEN']} headers = {"Authorization": "Bearer " + current_app.config['OWNCAST_ACCESS_TOKEN']}
r = requests.post(url, headers=headers) r = requests.get(url, headers=headers)
unique_users = list(set(map(lambda user_object: user_object["user"]["id"], r.json()))) unique_users = list(set(map(lambda user_object: user_object["user"]["id"], r.json())))
for user_id in unique_users: for user_id in unique_users:
give_points_to_user(db, give_points_to_user(db,