You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some servers expose the different DICOMweb RESTful services using different path prefixes.
@@ -41,25 +41,33 @@ To interact with servers requiring authentication, ``DICOMwebClient`` accepts ar
41
41
42
42
from requests.auth import HTTPBasicAuth
43
43
from dicomweb_client.api import DICOMwebClient
44
+
from dicomweb_client.session_utils import create_session_from_auth
45
+
46
+
auth=HTTPBasicAuth('myusername', 'mypassword')
47
+
session = create_session_from_auth(auth)
44
48
45
49
client = DICOMwebClient(
46
50
url="https://mydicomwebserver.com",
47
-
auth=HTTPBasicAuth('myusername', 'mypassword')
51
+
session=session
48
52
)
49
53
50
54
To simplify usage for ``HTTPBasicAuth``, you may also directly provide a username and password using the corresponding arguments.
51
55
52
56
.. code-block:: python
53
57
54
58
from dicomweb_client.api import DICOMwebClient
59
+
from dicomweb_client.session_utils import create_session_from_user_pass
60
+
61
+
session = create_session_from_user_pass(
62
+
username='myusername',
63
+
password='mypassword'
64
+
)
55
65
56
66
client = DICOMwebClient(
57
67
url="https://mydicomwebserver.com",
58
-
username="myusername",
59
-
password="mypassword"
68
+
session=session
60
69
)
61
70
62
-
63
71
To interact with servers supporting token-based authorization, you can provide the access token using the ``headers`` argument (the header will be included in every client request message).
64
72
65
73
.. code-block:: python
@@ -78,13 +86,38 @@ To interact with servers requiring certificate-based authentication, you can pro
To interact with a server of the Google Healthcare API requiring OpenID Connect based authentication and authorization provide a session authenticated using the Google Cloud Platform (GCP) credentials.
105
+
See `GCP documentation <https://cloud.google.com/docs/authentication/production>`_ for details.
106
+
107
+
Note that GCP authentication requires installation of the package distribution with the ``gcp`` extra requirements: ``$ pip install dicomweb-client[gcp]``.
108
+
109
+
.. code-block:: python
110
+
111
+
from dicomweb_client.api import DICOMwebClient
112
+
from dicomweb_client.session_utils import create_session_from_gcp_credentials
0 commit comments