mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add HTTPS detection
This commit is contained in:
parent
601137f81a
commit
6d0a25cca7
1 changed files with 7 additions and 1 deletions
|
@ -1969,7 +1969,13 @@ class OtherCog(commands.Cog):
|
||||||
embed.set_footer(text="Using server {} ({})".format(host, try_hosts.get(host, "Other")))
|
embed.set_footer(text="Using server {} ({})".format(host, try_hosts.get(host, "Other")))
|
||||||
|
|
||||||
msg = await ctx.respond(embed=embed, ephemeral=False)
|
msg = await ctx.respond(embed=embed, ephemeral=False)
|
||||||
async with httpx.AsyncClient(base_url=f"http://{host}/api", follow_redirects=True) as client:
|
async with httpx.AsyncClient(follow_redirects=True) as client:
|
||||||
|
try:
|
||||||
|
await client.get(f"https://{host}/api/tags")
|
||||||
|
client.base_url = f"https://{host}/api"
|
||||||
|
except httpx.ConnectError as e:
|
||||||
|
client.base_url = f"http://{host}/api"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = await client.get("/tags")
|
response = await client.get("/tags")
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
Loading…
Reference in a new issue