ndg-httpsclient provides enhanced HTTPS support for Python's standard library modules `httplib` and `urllib2` (Python 2) or `http.client` and `urllib.request` (Python 3) using PyOpenSSL. It allows for advanced SSL/TLS features like Server Name Indication (SNI) and robust peer certificate verification, extending capabilities beyond the default standard library implementation. The current version is 0.5.1, with a relatively slow release cadence focused on compatibility and critical fixes.
pip install ndg-httpsclientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates using `ndg-httpsclient`'s `open_url` utility to make an HTTPS request. This function internally leverages the PyOpenSSL-enhanced `HTTPSHandler` that the library integrates into Python's standard HTTP client modules. For more advanced use, like client certificate authentication or custom CA bundles, additional arguments can be passed to `open_url`.
Upgrade Python to a supported version (e.g., Python 3.6+) or pin `ndg-httpsclient<0.5.1`.
Understand that this library is a low-level enhancement for specific SSL/TLS requirements, not a replacement for higher-level HTTP client libraries.
If relying on `ndg.httpsclient.utils.open_url`, ensure you are on version 0.4.3 or higher.
For most new HTTP-related projects, consider `requests`. Use `ndg-httpsclient` when explicit PyOpenSSL control or compatibility with existing standard library code is a strict requirement.
Update calls to `ndg.httpsclient.utils.open_url` to provide the `config` argument, or pin `ndg-httpsclient<0.5.0` if the older signature is required.
Ensure `pyOpenSSL`, `ndg-httpsclient`, and `pyasn1` are installed and up-to-date using `pip install --upgrade pyOpenSSL ndg-httpsclient pyasn1` to provide more robust SSL/TLS capabilities, especially for SNI and certificate verification. Updating system CA certificates may also be necessary.
Install `pyOpenSSL`, `ndg-httpsclient`, and `pyasn1` using `pip install pyOpenSSL ndg-httpsclient pyasn1` to provide enhanced SSL/TLS capabilities, including SNI support, for older Python environments.
Install `pyOpenSSL` using pip: `pip install pyOpenSSL`. On some systems, development headers for OpenSSL (`libssl-dev` on Debian/Ubuntu, `openssl-devel` on Fedora) and `libffi-dev` might be required before installing `pyOpenSSL` and its dependencies.
Ensure `pyOpenSSL`, `ndg-httpsclient`, and `pyasn1` are installed and up-to-date (`pip install --upgrade pyOpenSSL ndg-httpsclient pyasn1`) to provide robust SSL/TLS capabilities and SNI support. Verify the server's SSL/TLS configuration for compatibility and ensure the client platform's OpenSSL libraries are correctly configured.