- Verify Python and requests Library Versions
- Use Python 3.9.3 or later. If upgrading Python is not an option, use HTTP instead of HTTPS.
- Confirm the version of the requests library. While the latest version is recommended, the issue primarily lies with the Python version rather than the library.
- Switch to HTTP Proxy (Port 65534)
- If upgrading Python is not possible due to dependency constraints, use the HTTP proxy on port 65534.
- The HTTP proxy works well with all versions of Python and does not require an upgrade.
- Modify the proxy configuration in the script to use HTTP as shown below:
Configuration Note: While configuring your proxy settings in Python, it’s important to note that even though the requests library expects both http and https keys in the configuration, you can set both keys to the HTTP proxy address (using port 65534). This configuration works correctly and ensures compatibility across different Python versions.
- Compatibility: Be aware that while HTTP is less secure than HTTPS, it might be the only viable solution when working with older Python environments.