How to Upload a New Config Using the Python SDK

Besides configuring Mona via the configuration page in the dashboard, users can upload a new config file to Mona via our Python SDK. (see SDK installation here).

Mona's SDK provides a simple way to upload a new Mona configuration, using my_client.upload_config()

Arguments:

config: Your new Mona configuration represented as a python dict (both the configuration dict with your user_id as the top key and just the configuration dict itself are accepted).
commit_message: A short description of the changes that were made.
author: An email address identifying the configuration uploader. Mona will use this mail to send updates regarding re-creation of insights upon this configuration change. When not supplied, the author will be the Client's api-key, and you will not get updates regarding the changes mentioned above. Must be provided when using un-authenticated mode.

new_configuration = {
    "MY_CONTEXT_CLASS": {
        "fields": <fields dict>, 
        "field_vectors": <field vectors dict>
        "stanzas_global_defaults": <global defaults dict>, 
        "stanzas": <stansas dict>,
        "notifications": <notifications dict>
    }
}
author = '[email protected]'
upload_result = my_client.upload_config(new_configuration, "My commit message", author)

# the return value format will be:
# upload_result == {
#    "success": <was the upload successful>, (bool)
#    "new_config_id": <the new configuration ID> (str)
#}

You can also receive your current Mona configuration like this:

my_current_mona_config = my_client.get_config()

Or get a suggested configuration based on your data:

my_suggested_mona_config = my_client.get_suggested_config()

Did this page help you?