test httpx
This commit is contained in:
parent
f6d4806ef6
commit
240da44f2f
2 changed files with 4 additions and 7 deletions
|
@ -3,7 +3,7 @@ import os
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import httpx
|
||||||
import discord
|
import discord
|
||||||
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
|
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
@ -126,13 +126,10 @@ 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:
|
||||||
if requests.get(head_url).status_code == 200:
|
async with httpx.AsyncClient() as client:
|
||||||
response = requests.get(head_url)
|
response = await client.get(head_url)
|
||||||
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)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
APScheduler==3.11.0
|
APScheduler==3.11.0
|
||||||
requests==2.32.3
|
httpx==0.28.1
|
||||||
discord.py==2.4.0
|
discord.py==2.4.0
|
||||||
audioop-lts==0.2.1
|
audioop-lts==0.2.1
|
||||||
python-ffmpeg==2.0.12
|
python-ffmpeg==2.0.12
|
Loading…
Add table
Reference in a new issue