Coder Social home page Coder Social logo

workday's Introduction

Python client for Workday

This is a Python client (2.7 or 3.4+) for communicating with one of the Workday XML/SOAP APIs.

PyPI version Build Status Code style: black Documentation Status

Features

This client

  • facilitates the authentication to a Workday SOAP API (Workday Web Services) and the parsing of data.
  • supports Anonymous, Basic HTTP and WS-Security (which is the prefered configuration in Workday)
  • allows the setup of multiple WWS endpoints
  • native paging support for all responses from the API using Python iterators

Configuring WSDLs

The first parameter of the WorkdayClient constructor is a dictionary. This dictinary contains all the APIs you want to access and the endpoints of them.

The key used in the dictionary will then become a property of the client instance with the methods for that API.

import workday

apis = {
    'talent': 'https://workday.com/tenant/434$sd.xml',
    'hcm': 'https://workday.com/tenant/hcm$sd.xml'
}

client = workday.WorkdayClient(
    wsdls=apis, 
    authentication=... 
    )

users = client.hcm.Get_Users()

Any calls to an API method will return an instance of workday.client.WorkdayResponse.

If you want to page results, an instance of WorkdayResponse is iterable, for example:

results = []
for certs in client.talent.Get_Certifications():  # Loops over all available pages
    results.extend(certs.data['Certification'])
print(results)

The data will be in the data property of any API response.

Authentication Examples

All authentication methods are in the workday.auth module and the instance of them should be passed to the WorkdayClient constructor as the authentication argument.

No authentication

from workday.auth import AnonymousAuthentication

anon = AnonymousAuthentication()

client = workday.WorkdayClient(
    authentication=anon,
    ...
)

WS-Security username/password

from workday.auth import WsSecurityCredentialAuthentication

auth = WsSecurityCredentialAuthentication('my_user@tenant_name', 'mypassword')

client = workday.WorkdayClient(
    authentication=auth,
    ...
)

WS-Security X509-only authentication

from workday.auth import WsSecurityCertificateAuthentication

auth = WsSecurityCertificateAuthentication('/path/to/private.key', '/path/to/public.key')

client = workday.WorkdayClient(
    authentication=auth,
    ...
)

WS-Security X509-only signed credentials (Recommended by Workday)

from workday.auth import WsSecurityCertificateCredentialAuthentication

auth = WsSecurityCertificateCredentialAuthentication(
    'user@tenant',
    'password',
    '/path/to/private.key',
    '/path/to/public.key')

client = workday.WorkdayClient(
    authentication=auth,
    ...
)

Example

This simple example returns a list of dictionaries back from the Workday API for each configured language.

import workday
from workday.auth import WsSecurityCredentialAuthentication

client = workday.WorkdayClient(
    wsdls={'talent': 'https://workday.com/tenant/434$sd.xml'}, 
    authentication=WsSecurityCredentialAuthentication(config['user'], config['password']), 
    )

print(client.talent.Get_Languages().data)

Credits

This module was written by Anthony Shaw at Dimension Data

Contributions

Always welcome. See CONTRIBUTING.rst

workday's People

Contributors

joonro avatar tonybaloney avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.