SSL Adapter for requests library
Project description
Overview
SSL Adapter is a Python package that provides utilities for handling SSL connections and creating sessions with SSL adapters.
Installation
Install Your Package Name using pip:
pip install ssladapter
Usage
Creating a Session with SSL Adapter
To create a session with an SSL adapter, you can use the session_ssl_adapter function provided by the package.
from ssladapter.entry import session_ssl_adapter
# Create a session with SSL adapter
session = session_ssl_adapter(
certfile='/path/to/client_certificate.pem',
keyfile='/path/to/client_private_key.pem',
password='your_password', # Optional
cacertfile='/path/to/ca_certificate.pem' # Optional
)
# Use the session for making requests
response = session.get('https://example.com/api')
Creating an SSL Adapter
Alternatively, you can directly create an instance of the SSLAdapter class and use it to customize a session with SSL configuration.
from ssladapter.ssl_adapter import SSLAdapter
from requests import Session
# Create an SSL adapter instance
ssl_adapter = SSLAdapter(
certfile='/path/to/client_certificate.pem',
keyfile='/path/to/client_private_key.pem',
password='your_password', # Optional
cacertfile='/path/to/ca_certificate.pem' # Optional
)
# Create a session and mount the SSL adapter
session = Session()
session.mount('https://', ssl_adapter)
# Use the session for making requests
response = session.get('https://example.com/api')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ssladapter-0.1.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for ssladapter-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84dcd0dcef3cb8e5c8e2895848d71a4b1bbddceeedc08932d064de18efa72ffb |
|
MD5 | 6a51552e49e233223720f7a18fb0c0ee |
|
BLAKE2b-256 | ba5571c39d8ed9750f72771c163aa8a6861a1f57714ad5f66f4861ce7502246e |