Python SDK Guide

Before using the Python CLI or create your own Python app, you must configure it to work with OpenAM, the component that handles every authorization process. This guide will explain you how to proceed.

Create and configure a new agent


Only one administrator should be able to access the OpenAM panel and create new agents. If you are a developper, please ask the administrator to take care of this operation for you and skip to the next part.

The word "agent" is similar to the word "application" here. If you're not familiar with OAuth2, this means that we have to create an account that your Python app will use to authenticate, and therefore be allowed to interact with XMS.

To do that, go to your OpenAM panel, generally located at the URL: and login with your credentials.

Then, go to the tab Access control, click on the xlc realm, Agents tab, OAuth 2.0 Client tab, and create a New agent. Type the OAuth client user of your choice and a password, and remember those values.

You will be redirected to the page listing all of the agents. Click on the newly created agent to edit its properties.

The only thing you have to change here is in the Scope(s) section. You have to add to values: tokenScoped and userScoped. Be sure that they both appear in the Current Values list before saving the page.

Configure your app to connect to XMS with this agent's credentials

You should now be in possession of four values: the client user and password for your app, as well as the XMS endpoint ( and OpenAM endpoint (

Create a new file in the same directory as the file of your Python app, and complete the following config with your own values. The URLs need http:// at the beginning.

Configuration file: sdk.conf


Finally, your Python app should use the following function in order to read this file:

Configuration file parsing function

def load_configuration():
    configFile = os.path.join(os.path.dirname(file), 'sdk.conf')
        config = ConfigParser.ConfigParser()
        return dict(config.items("XmsCli"))
        raise Exception("Error during reading configuration from file: "+configFile)

accept That's it! You should now be ready to write your own Python app and use it to interact with XMS.

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 5.4.6 - Documentation - Legal Notice

Site maintained by