Question

Platform SDK for Python Version 5.2.1 pipeline.committer return

  • 30 October 2023
  • 1 reply
  • 20 views

I am using the python SDK and I when I use the method “.committer” or “.last_modified_by” on a pipeline object, I am expecting to get back an email that I am able to see under “Committed By” on the platform. However, I get back a long string that I can’t make out:

sudo code of what I am doing:

 

sch = ControlHub(credential_id="cred_id,token = token)
print(sch.pipelines.get(commit_id = commit_id).last_modified_by)

 

and instead of getting a string of an email returned, I am getting something like this returned:

a83b3195-61f4-11ee-a6e4-…..@b5f95dcd-5f00-11ec-b405-……

 

Would you happen to know how I can turn this string into a valid email? I couldn’t find anything on this topic in the docs. 
 


1 reply

Hi,

I also encountered this issue when I was trying to read the email ids of users who last modified and committed the pipeline.

What I did was I read the user ids (the string mentioned by you is the user id) and their respective email addresses using the sch.users.get_all() method, stored them in a dictionary as key-value pairs, and then accessed the value using key as sch.pipelines.get(commit_id = commit_id).last_modified_by attribute.

There may be an easier way but this is what I could come up with. I have shared a sample snippet below.

for user in sch.users.get_all():     user_dict[user.id]=user.email_address
for pipeline in self.sch.pipelines:         
     print(user_dict[pipeline.last_modified_by])

Hope you find this useful.

 

 

Reply