Skip to content

Commit d96eb35

Browse files
damian3031hashhar
authored andcommitted
Document usage of the http_session parameter
1 parent 1e95bbf commit d96eb35

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,23 @@ The transaction is created when the first SQL statement is executed.
520520
exits the *with* context and the queries succeed, otherwise
521521
`trino.dbapi.Connection.rollback()` will be called.
522522

523+
## Custom requests Session
524+
525+
You can create a custom [requests.Session object](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) and pass it to the `http_session` parameter. This can be used for things like setting additional HTTP headers, client certificates, etc.
526+
527+
```python
528+
import requests
529+
from trino.dbapi import connect
530+
531+
s = requests.Session()
532+
s.cert = '/path/client.cert'
533+
534+
conn = connect(
535+
http_session=s,
536+
...
537+
)
538+
```
539+
523540
## Legacy Primitive types
524541

525542
By default, the client will convert the results of the query to the

0 commit comments

Comments
 (0)