check playhead status code
This commit is contained in:
parent
e7f445d164
commit
c57d8e5c7e
1 changed files with 8 additions and 5 deletions
|
@ -126,14 +126,17 @@ async def stop_error(ctx, error):
|
||||||
async def query_playhead():
|
async def query_playhead():
|
||||||
head_url = f'https://{scheduler_hostname}/playhead'
|
head_url = f'https://{scheduler_hostname}/playhead'
|
||||||
try:
|
try:
|
||||||
#requests.get(head_url).status_code == 200
|
if requests.get(head_url).status_code == 200:
|
||||||
response = requests.get(head_url)
|
response = requests.get(head_url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
playhead = response.json()
|
playhead = response.json()
|
||||||
logger_discord.info(f'Querying playhead at {head_url}')
|
logger_discord.info(f'Querying playhead at {head_url}')
|
||||||
|
else:
|
||||||
|
logger_discord.error('Cannot connect to the playhead!')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger_discord.error('Cannot connect to the playhead!')
|
logger_discord.error('Cannot connect to the playhead!')
|
||||||
logger_discord.error(e)
|
logger_discord.error(e)
|
||||||
|
await asyncio.sleep(5)
|
||||||
return playhead
|
return playhead
|
||||||
|
|
||||||
async def query_database():
|
async def query_database():
|
||||||
|
|
Loading…
Add table
Reference in a new issue