Skip to content

Commit

Permalink
Add warnings for packages and libraries to avoid inject_into_ssl() (#122
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sethmlarson authored Nov 2, 2023
1 parent bc81d52 commit b7e9dbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Truststore **requires Python 3.10 or later** and supports the following platform

## User Guide

> **Warning**
> **PLEASE READ:** `inject_into_ssl()` **must not be used by libraries or packages** as it will cause issues on import time when integrated with other libraries.
> Libraries and packages should instead use `truststore.SSLContext` directly which is detailed below.
>
> The `inject_into_ssl()` function is intended only for use in applications and scripts.
You can inject `truststore` into the standard library `ssl` module so the functionality is used
by every library by default. To do so use the `truststore.inject_into_ssl()` function:

Expand All @@ -57,7 +63,7 @@ import requests
resp = requests.get("https://example.com")
```

If you'd like finer-grained control you can create your own `truststore.SSLContext` instance
If you'd like finer-grained control or you're developing a library or package you can create your own `truststore.SSLContext` instance
and use it anywhere you'd use an `ssl.SSLContext`:

```python
Expand Down
6 changes: 6 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Truststore **requires Python 3.10 or later** and supports the following platform

## User Guide

```{warning}
**PLEASE READ:** `inject_into_ssl()` **must not be used by libraries or packages** as it will cause issues on import time when integrated with other libraries.
Libraries and packages should instead use `truststore.SSLContext` directly which is detailed below.
The `inject_into_ssl()` function is intended only for use in applications and scripts.
```

You can inject `truststore` into the standard library `ssl` module so the functionality is used
by every library by default. To do so use the `truststore.inject_into_ssl()` function.

Expand Down

0 comments on commit b7e9dbf

Please sign in to comment.