mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
httpx man
This commit is contained in:
parent
db634f2a73
commit
a6f2055b8c
1 changed files with 19 additions and 22 deletions
|
@ -855,18 +855,15 @@ class OtherCog(commands.Cog):
|
|||
await ctx.respond("Removed domain from blacklist.")
|
||||
|
||||
@staticmethod
|
||||
async def check_proxy(self, url: str = "socks5://localhost:1090"):
|
||||
async with httpx.AsyncClient(
|
||||
http2=True
|
||||
) as client:
|
||||
async def check_proxy(url: str = "socks5://localhost:1090"):
|
||||
client = httpx.AsyncClient(http2=True)
|
||||
my_ip64 = (await client.get("https://api64.ipify.org")).text
|
||||
my_ip4 = (await client.get("https://api.ipify.org")).text
|
||||
real_ips = [my_ip64, my_ip4]
|
||||
await client.aclose()
|
||||
|
||||
# Check the proxy
|
||||
with httpx.AsyncClient(
|
||||
proxies=url
|
||||
) as client:
|
||||
client = httpx.AsyncClient(http2=True, proxies=url)
|
||||
try:
|
||||
response = await client.get(
|
||||
"https://1.1.1.1/cdn-cgi/trace",
|
||||
|
@ -878,7 +875,7 @@ class OtherCog(commands.Cog):
|
|||
return 1
|
||||
except (httpx.TransportError, httpx.HTTPStatusError):
|
||||
return 2
|
||||
|
||||
await client.aclose()
|
||||
|
||||
@commands.slash_command(name="yt-dl")
|
||||
@commands.max_concurrency(1, commands.BucketType.user)
|
||||
|
|
Loading…
Reference in a new issue