Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Last active August 6, 2021 00:38
Show Gist options
  • Save MatthewJDavis/5823fa942fe753d320417eab2bc36a03 to your computer and use it in GitHub Desktop.
Save MatthewJDavis/5823fa942fe753d320417eab2bc36a03 to your computer and use it in GitHub Desktop.
Python script using Zeep to return a Worker from the Workday API
'''
Query the Workday API using the Zeep package to return the details of the specified worker from their employee ID.
Details of the user and their password should be set in environment variables, like so in bash:
export user=''
export password=''
'''
import zeep, os
from zeep import Client
from zeep.wsse.username import UsernameToken
hostname = ''
tenant_name = ''
employee_id = '1234'
user = os.getenv('user')
password = os.getenv('password')
url = f'https://{hostname}.workday.com/ccx/service/{tenant_name}/Human_Resources/v36.2?wsdl'
client = Client(url, wsse=UsernameToken(user, password))
request_dict = {
'Worker_Reference': {
'ID': {
'type': 'Employee_ID',
'_value_1': employee_id
},
'Descriptor': None
},
'Skip_Non_Existing_Instances': None,
'Ignore_Invalid_References': None
}
client.service.Get_Workers(request_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment