pyxnat.Interface

class pyxnat.Interface(server=None, user=None, password=None, config=None, anonymous=False, proxy=None, verify=None)

Main entry point to access an XNAT server.

>>> central = Interface(server='http://central.xnat.org:8080',
                        user='login',
                        password='pwd')

Or with config file:

>>> central = Interface(config='/home/me/.xnat.cfg')

Or for interactive use:

>>> central = Interface('http://central.xnat.org')

Note

The interactive mode is triggered whenever an argument (between server, user or password) is missing. In interactive mode pyxnat will check that connection settings are valid.

Note

Proxy support requires the socks module be installed. This can be installed via pip:

pip install SocksiPy-branch

Or anonymously (unauthenticated):

>>> central = Interface('http://central.xnat.org', anonymous=True)
Attributes
_mode: online | offline

Online or offline mode

Methods

close_jsession()

Closes the session with XNAT server and consumes the JSESSIONID token

delete(uri, **kwargs)

Wrapper around requests.delete() returns rquests.response object

disconnect()

Tell XNAT to disconnect this session

get(uri, **kwargs)

Wrapper around requests.get() returns rquests.response object

head(uri, **kwargs)

Wrapper around requests.head() returns rquests.response object

load_config(location)

Loads a configuration file and replaces current connection parameters.

post(uri, **kwargs)

Wrapper around requests.post() returns rquests.response object

put(uri, **kwargs)

Wrapper around requests.put() returns rquests.response object

save_config(location)

Saves current configuration - including password - in a file.

set_logging

version