You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this line in my py source code (Python 3.10.1 64-bit):
from requests.packages.urllib3.exceptions import InsecureRequestWarning
Pylance extension in VSCode (running on Win10-64) reports problem: Import "requests.packages.urllib3.exceptions" could not be resolved from source
Although requests package is properly installed and the import is valid.
Performing same import on CLI produces no error:
C:\Users\UUUU\Documents\scripts>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests.packages.urllib3.exceptions import InsecureRequestWarning
>>>
The text was updated successfully, but these errors were encountered:
The type information for the requests library comes from the open-source typeshed repo.
There is a comment at the top of the reqests/packages/__init__.pyi stub that points to the issue you're seeing. It says "requests also imports urllib3 as requests.packages.urllib3, the stubs don't reflect that". This issue further explains what's happening. The maintainers of typeshed have apparently decided not to reflect the fact that urllib3 is re-exported from requests.packages. Since urllib3 is a separate library from requests, you can import directly from it rather than importing the (re-exported) reference to it from within requests.packages.
I have this line in my py source code (Python 3.10.1 64-bit):
from requests.packages.urllib3.exceptions import InsecureRequestWarning
Pylance extension in VSCode (running on Win10-64) reports problem:
Import "requests.packages.urllib3.exceptions" could not be resolved from source
Although requests package is properly installed and the import is valid.
Performing same import on CLI produces no error:
The text was updated successfully, but these errors were encountered: