copyxnat.xnat_backend.xnat_session module¶
Wrappers for communicating between copyxnat items and pyXNAT backend items
- class copyxnat.xnat_backend.xnat_session.RestWrapper(params)[source]¶
Bases:
object
Wrapper around the XNAT REST API which automatically assembles the URL from the server name in the provided params and REST API URI
- class copyxnat.xnat_backend.xnat_session.SessionId[source]¶
Bases:
object
Wrapper around an XNAT session ID cookie
- class copyxnat.xnat_backend.xnat_session.XnatSession(params, read_only=False)[source]¶
Bases:
object
Wrapper around the XNAT REST API which automatically handles session authentication and tokens using the provided credentials
- request(method, uri, qs_params=None, body=None, headers=None, stream=None)[source]¶
Send a REST call to an XNAT server. The call will be authenticated automatically by adding the XNAT JSESSION ID to the REST headers. If the JSESSION ID does not already exist, it will be created by authenticating with the server using the user credentials.
- Parameters
method – Request method (eg get, put, post)
uri – XNAT REST API string (excluding https://server/data/)
qs_params – dictionary of querystring parameters for the request
body – request body
headers – dictionary of headers for the request
stream – True if content is streamed
- Returns
requests.Response