pawelsikora / mkdocs-with-confluence

MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API
MIT License
67 stars 33 forks source link

feat(session): support headers and don't set username/password if none #25

Open ahmet2mir opened 6 months ago

ahmet2mir commented 6 months ago

Hello,

In order to support all differents auth provided by Confluence, i simply ignore username/password inside session and allow adding extra headers with config to allow all supported auth.

When we set headers on requests session, they are "merged" with headers on session requests.

Example

$ python -m http.server
$ python
Python 3.9.5 (default, May 27 2021, 16:11:10) 
>>> import requests
>>> session = requests.Session()
>>> session.headers={"x-test-var": "hello"}
>>> r = session.get("http://localhost:8000", headers={"x-other-header": "world"})
>>> r.request.headers
{'x-test-var': 'hello', 'x-other-header': 'world'}