Authentication¶
Http session authentication is not strictly part of DICOM server interaction. However, it is a practical issue that
will pop up in real-world situations. Every vendor, model, server installation will have its own authentication
mechanism. As such it is impossible to provide a generic solution. Dicomtrolley ships with authentication adapters for
the Vitrea Connection 8.2.0.1 system that it was developed on.
Vitrea Auth¶
There is a custom requests authentication class for Vitrea Connection:
session = requests.Session()
session.auth = VitreaAuth(
login_url="https://server/login",
user="user",
password="password",
realm="realm",
)
# then just use the session
searcher=Mint(session, "https://server/mint")
requests.auth.AuthBase class is that login is automatically retried should authentication
time out or be disrupted for other reasons.
Basic Auth¶
import requests
from requests.auth import HTTPBasicAuth
session = requests.Session()
session.auth = HTTPBasicAuth('user','password')
trolley = Trolley(
searcher=QidoRS(session=session, url="https://server/qido"),
downloader=WadoRS(session=session, url="https://server/wado_rs"))
Custom Auth¶
The only thing dicomtrolley needs is an authenticated requests.Session instance:
session = requests.Session()
# do whatever you need to authenticate
session.post("https://server/login",
headers={"user":"a_user",
"password":"secret"})
# use session in trolley, searcher and downloader creation
trolley=Trolley(searcher=Mint(session, "https://server/mint"),
downloader=WadoRS(session, "https://server/wadors"))