Skip to main content

Python interface to Dundas rest api.

Project description

Manage sessions for Dundas.


Dundas has a very complete REST API.

With completeness comes complexity, and this module will help you use the query in an easier way.

Why this module is useful

It currently does 3 things for you.

If you use dundas.Session within a context manager, the context manager wil log you in and out automagically, no matter what happens. You can use the session object as a normal object as well as long as you do not forget to log in and out yourself.

Each and every call to the API needs to have the same sessionId parameter. This module creates shortcuts for you for get, post and delete, to make your life easier. You do not need to repeat the host, api path prefix or sessionId every single time.

Some API calls are ported and might have helper methods. I am updating the module based on what I need and use, so I do not expect to have everything ported on my own.


Simply with pip, from pypi:

python3 -m pip install pydundas

or, assuming you do not have permission to store the module globally:

python3 -m pip install --user pydundas

The module should be able to work with python2 as well, but it is untested and as python2 will be end of life'd in a few months anyway I did not look into it.


You can see all the examples in one directory.

All the examples below assume a url, user and pwd variables.

Happy flow with context manager

with Session(user=user, pwd=pwd, url=url) as d:

Output (example):


When the variable d comes out of scope, so outside the with statement, you will be automagically logged out.

Read credentials from a yaml file

If you have a yaml file with a user, pwd and url key, then you can read it from pydundas:

user: arya
pwd: 'valar morghulis'
from pydundas import creds_from_yaml
with Session(**creds) as d:

Exception within the context manager are properly handled

with Session(user=user, pwd=pwd, url=url) as d:


404 Client Error: Not Found for url:

API calls


Most constants can be used via their human-readable name.

from pydundas import Api, Session, creds_from_yaml

with Session(**creds_from_yaml('credentials.yaml')) as d:
    c = a.constant()
    # returns '679e6337-48aa-4aa3-ad3d-db30ce943dc9'


You can warehouse a cube, and get some information about it:

with Session(**creds) as d:
    api = Api(d)
    capi = api.cube()
    cube = capi.getByPath('Awesome Project', '/relevant/path')
    cube = capi.getByPath('DP', '/CustomReports/2daysent/1mailing sendouts')
    if cube is None:
        print("Gotcha, no cube named like that.")



You can run all checks, and fix the failing one:

with Session(**creds, loglevel='warn') as d:
    api = Api(d)
    hapi =
    failings = hapi.check(allchecks=True)
    for f in failings:
        hapi.check([f], fix=True)


You can get a notification by its name and then run it.

    napi = api.notification()
    notif = napi.getExactName(name='Awesome notification')

    if len(notif) != 1:
        print("None or more than one notification with this name.")


For example, to find the ID of a project:

from pydundas import Api, Session, creds_from_yaml

with Session(**creds_from_yaml('credentials.yaml')) as d:
    project = a.project()


You can either use conda or virtualenv. Most relevant commands are in the Makefile. First edit the first line of the makefile to choose if you want to use conda or virtualenv.

# Build an environment with all dependencies
make devinit

# Tests
make pep8
make unittest

# Build a package
make package

# Clean up everything
make purge

Project details

Download files

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

Source Distribution

pydundas-1.6.1.tar.gz (27.6 kB view hashes)

Uploaded source

Built Distribution

pydundas-1.6.1-py3-none-any.whl (36.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page