-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Overview
Below you'll see a bug report about two different issues which both are the result of using a proxy.
First Issue
When requesting the Discord API with proxies using httpx.Client() after some time this issue happen:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/usr/local/lib/python3.9/dist-packages/httpcore/_sync/connection_pool.py", line 253, in handle_request
raise exc
File "/usr/local/lib/python3.9/dist-packages/httpcore/_sync/connection_pool.py", line 237, in handle_request
response = connection.handle_request(request)
File "/usr/local/lib/python3.9/dist-packages/httpcore/_sync/http_proxy.py", line 267, in handle_request
raise ProxyError(msg)
httpcore.ProxyError: 502 Bad Gateway
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/home/admin/bot/main.py", line 170, in verify
VERIFYCODE = waitsms()
File "/home/admin/bot/main.py", line 155, in waitsms
discordresponse = client.post(discordurl, json=data, headers=HEADERS)
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1130, in post
return self.request(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 815, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 902, in send
response = self._send_handling_auth(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 930, in _send_handling_auth
response = self._send_handling_redirects(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 967, in _send_handling_redirects
response = self._send_single_request(request)
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1003, in _send_single_request
response = transport.handle_request(request)
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.9/dist-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ProxyError: 502 Bad Gateway
Second Issue
Sometimes after some time, instead of the 502 error above, another issue appear:
Server closed without sending response`
(Currently i don't have the full Traceback for this issue ready to include here)
To Reproduce
Do a http request to discord.com while using proxies:
data1 = {"foo": "bar"}
with httpx.Client(headers=HEADERS, timeout=timeout, proxies=proxyauth if proxytype != "" else None) as client:
resp2 = client.post("https://discord.com/api/v9/users/@me", json=data1)
lock.acquire()
if resp2.status_code == 204: pystyle.Write.Print("\t[+] Successfully requested api!\n", pystyle.Colors.green, interval=0)
lock.release()Expected behavior
In case you use a proxy, it should request the api as usual without any issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels