Skip to main content

Basic library for interacting with the REST interface of XNAT.

Project description

The Boring XNAT Library (BXL)

PyPI version pipeline status coverage report

BXL is a library for interacting with the REST interface of XNAT (Extensible Neuroimaging Archive Toolkit), an open-source imaging informatics software platform.



BXL is available at PyPI, the Python Package Index.

With pip package management system:

 pip install bxl

Without pip:

 git clone .
 cd ./bxl
 python install

Credentials handling

The xnat.Connection() class constructor expects a credentials argument to be passed when instantiated,

  • If is a tuple, it will proceed to a basic authentication procedure against the host XNAT instance.
  • If is a basestring, it will reuse it as a cookie for authentication against the host XNAT instance.
  • Otherwise (or if authentication procedure failed in the aforementioned cases), it will remain offline.


Connect to XNAT instance using an existing JSESSIONID token and get a list of user-visible XNAT projects

 import bxl.xnat as xlib

 c = xlib.Connection(hostname='',credentials='1A12346385E876546C99B4179E20986A')
 data = c.get_projects()

 projects = { item['ID'] : item['URI'] for item in data.values() }


Connect via 'with' statement to create a new Female subject 'dummy' in the 'test' project

 from bxl import xnat

 with xnat.Connection(hostname='',credentials=(usr,pwd)) as c :
     response = c._put_resource(URI = + '/data/projects/test/subjects/dummy',
                                options = {'gender' : 'female'} )
     subject_uid = response.content
     print 'New subject %s created!' %subject_uid

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bxl, version 0.3.4.post1
Filename, size File type Python version Upload date Hashes
Filename, size bxl-0.3.4.post1-py2-none-any.whl (17.1 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size bxl-0.3.4.post1-py3-none-any.whl (17.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page