Firstly it is super different if you are using PyCelonis from within MLWB or from somewhere outside of Celonis.
Only within MLWB
celonis = get_celonis() works out of the box.
Otherwise you can pass in the get_celonis a lot of different paramters.
I would create an API Token for your useraccount and use this one to establish connection.
by passing in url, api token and key type.
celonis = get_celonis(base_url=<your url>,
api_token=<Token you created,
key_type="USER_KEY")
Potentially even a proxy could be needed with proxies=... but that totally depends on your setup.
It is worth to mention, that the USER key should only be used for development phase and switched out with an application key once moving more into production.
1)I think your question is regarding how we can install new pycelonis version ,for that you can first uninstall the existing version using the code !pip uninstall pycelonis and then install the latest pycelonis version, for eg: if you need pycelonis 2.5.0 you can use !pip install pycelonis=="2.5.0",make sure you have only one pycelonis version installed otherwise it may cause circular import error when ever you trigger any python code.
2)a)For listing out dps in your code you can use the below code:
from pycelonis import get_celonis
celonis = get_celonis(permissions = False)
for dp in celonis.data_integration.get_data_pools():
print(dp.name)
b) And then if you want to import specific dp from that list you can use the below code:
I had already updated pycelonis new version 2.6.0 .previous version when i was fetching kpi that time i was use api_request .but new version i unable to fetch api because throw error celonis object has no attribute api request and if i fetch any url then throw celonis has no attribute url. So my question is can you please tell me new how i can use url
In the new version of pycelonis ,if you want to use api functionalities (get,post,upsert,delete) firstly you have to install certain python packages such as json and requests. You can use the code !pip install json and !pip install requests. After that you can use the below code. For eg: you are performing a get operation to retrieve data from a specific end point and you want to print the json file response.
from pycelonis import get_celonis
import json
import requests
celonis = get_celonis(permissions = False)
response = celonis.client.request("GET", "add your api end point here")
NB: if {c.url} variable has a url in it then you have to replace it in the api call you are making. for example if c.url = "https://sample/" then in the api call you have to replace it as
Hope you have imported json in your code using import json , and after that try to replace this part of your code t_list = consumption_table["extendedTableConsumptionTransports"] with the below code:
use this code i got error JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hi Ankit,
The error you are encountering is because you are trying to decode an empty or invalid json string , you are trying to parse a json response that is empty or not properly formatted . So please check the url you are using.