1
0
Fork 0

[cleanup] Misc fixes

Closes #7528
This commit is contained in:
pukkandan 2023-07-22 09:08:12 +05:30
commit 62b5c94cad
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
12 changed files with 37 additions and 32 deletions

View file

@ -28,7 +28,7 @@ from ._helper import (
make_socks_proxy_opts,
select_proxy,
)
from .common import Features, RequestHandler, Response, register
from .common import Features, RequestHandler, Response, register_rh
from .exceptions import (
CertificateVerifyError,
HTTPError,
@ -372,7 +372,7 @@ def handle_response_read_exceptions(e):
raise TransportError(cause=e) from e
@register
@register_rh
class UrllibRH(RequestHandler, InstanceStoreMixin):
_SUPPORTED_URL_SCHEMES = ('http', 'https', 'data', 'ftp')
_SUPPORTED_PROXY_SCHEMES = ('http', 'socks4', 'socks4a', 'socks5', 'socks5h')

View file

@ -105,7 +105,7 @@ class RequestDirector:
_REQUEST_HANDLERS = {}
def register(handler):
def register_rh(handler):
"""Register a RequestHandler class"""
assert issubclass(handler, RequestHandler), f'{handler} must be a subclass of RequestHandler'
assert handler.RH_KEY not in _REQUEST_HANDLERS, f'RequestHandler {handler.RH_KEY} already registered'