Воркед
This commit is contained in:
1 parent
ac32c55ab9
commit
ee94d8e529
1138 files changed
+55771
-77901
No files matched your search
@@ -1,6 +1,9 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
|
||||
from .filepost import encode_multipart_formdata
|
||||
from .packages import six
|
||||
from .packages.six.moves.urllib.parse import urlencode
|
||||
|
||||
__all__ = ["RequestMethods"]
|
||||
@@ -168,3 +171,21 @@ class RequestMethods(object):
|
||||
extra_kw.update(urlopen_kw)
|
||||
|
||||
return self.urlopen(method, url, **extra_kw)
|
||||
|
||||
|
||||
if not six.PY2:
|
||||
|
||||
class RequestModule(sys.modules[__name__].__class__):
|
||||
def __call__(self, *args, **kwargs):
|
||||
"""
|
||||
If user tries to call this module directly urllib3 v2.x style raise an error to the user
|
||||
suggesting they may need urllib3 v2
|
||||
"""
|
||||
raise TypeError(
|
||||
"'module' object is not callable\n"
|
||||
"urllib3.request() method is not supported in this release, "
|
||||
"upgrade to urllib3 v2 to use it\n"
|
||||
"see https://urllib3.readthedocs.io/en/stable/v2-migration-guide.html"
|
||||
)
|
||||
|
||||
sys.modules[__name__].__class__ = RequestModule
|
||||
Reference in new issue
Block a user