test httpx

This commit is contained in:
deflax 2025-02-08 03:41:34 +02:00
parent f6d4806ef6
commit 240da44f2f
2 changed files with 4 additions and 7 deletions

View file

@ -3,7 +3,7 @@ import os
import asyncio
import logging
import subprocess
import requests
import httpx
import discord
from discord.ext.commands import Bot, has_permissions, CheckFailure, has_role, MissingRole
from apscheduler.schedulers.asyncio import AsyncIOScheduler
@ -126,13 +126,10 @@ async def stop_error(ctx, error):
async def query_playhead():
head_url = f'https://{scheduler_hostname}/playhead'
try:
if requests.get(head_url).status_code == 200:
response = requests.get(head_url)
response.raise_for_status()
async with httpx.AsyncClient() as client:
response = await client.get(head_url)
playhead = response.json()
logger_discord.info(f'Querying playhead at {head_url}')
else:
logger_discord.error('Cannot connect to the playhead!')
except Exception as e:
logger_discord.error('Cannot connect to the playhead!')
logger_discord.error(e)

View file

@ -1,5 +1,5 @@
APScheduler==3.11.0
requests==2.32.3
httpx==0.28.1
discord.py==2.4.0
audioop-lts==0.2.1
python-ffmpeg==2.0.12