Adds barebones API skeleton using requests
This commit is contained in:
parent
3a67e98b71
commit
8b823a6386
27
runner.py
27
runner.py
|
@ -1,14 +1,33 @@
|
||||||
#! /Users/arianagiroux/Documents/Coding/owncast-obs-streamer/venv/bin/python3
|
#! /Users/arianagiroux/Documents/Coding/owncast-obs-streamer/venv/bin/python3
|
||||||
|
|
||||||
import chevron
|
import chevron
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
stream_data = json.load(open('resources/data.json', 'r'))
|
||||||
|
|
||||||
|
|
||||||
def render(data={}):
|
def render(data={}):
|
||||||
return chevron.render(template=open('index.html', 'r'), data=data)
|
return chevron.render(template=open('index.html', 'r'), data=data)
|
||||||
|
|
||||||
|
|
||||||
data_constructor = {
|
def getStatus():
|
||||||
'stream-title': 'a big test'
|
response = requests.get(stream_data['stream_url'] + '/api/yp')
|
||||||
}
|
response_data = response.json()
|
||||||
|
return {
|
||||||
|
'name': response_data['name'],
|
||||||
|
'online': response_data['online'],
|
||||||
|
'overallMaxViewerCount': response_data['overallMaxViewerCount'],
|
||||||
|
'sessionMaxViewerCount': response_data['sessionMaxViewerCount'],
|
||||||
|
'streamTitle': response_data['streamTitle'],
|
||||||
|
'viewerCount': response_data['viewerCount'],
|
||||||
|
'description': response_data['description'],
|
||||||
|
}
|
||||||
|
|
||||||
print(render(data_constructor))
|
|
||||||
|
def updateStreamTitle():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
print(render(getStatus()))
|
||||||
|
|
Loading…
Reference in New Issue