copyxnat.xnat_backend.xnat_rest_client module

Wrappers for communicating between copyxnat items and pyXNAT backend items

class copyxnat.xnat_backend.xnat_rest_client.XnatRestClient(params, read_only)[source]

Bases: object

Wrapper around XNAT REST API

download_file(uri, file_path, qs_params)[source]

Download file from server to specified file location

Parameters
  • file_path – full local destination path for file

  • uri – Relative URI of resource to download

  • qs_params – Additional query string parameters

logout()[source]

End this XNAT session

meta(uri)[source]

Return dictionary of XNAT metadata

request(uri, method, qs_params=None)[source]

Execute a REST call on the server. Does not return response

request_json_property(uri, optional=False, qs_params=None)[source]

Execute a REST call on the server and return result as list If optional is True, then a 404 response will yield an empty list

request_string(uri, qs_params=None)[source]

Execute a REST call on the server and return string

upload_file(method, uri, file_path, qs_params)[source]

Upload file to server from the specified location

Parameters
  • method – request method (post or put)

  • uri – Relative URI on the XNAT server

  • file_path – full local source path for file

  • qs_params – dictionary of querystring parameters