Skip to main content

Python client for Workday tenants

Project description

# 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](https://badge.fury.io/py/workday.svg)](https://badge.fury.io/py/workday)
[![Build Status](https://travis-ci.com/tonybaloney/workday.svg?branch=master)](https://travis-ci.com/tonybaloney/workday)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

# 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.

```python
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:

```python
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

```python
from workday.auth import AnonymousAuthentication

anon = AnonymousAuthentication()

client = workday.WorkdayClient(
authentiation=anon,
...
)
```


## WS-Security username/password

```python
from workday.auth import WsSecurityCredentialAuthentication

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

client = workday.WorkdayClient(
authentiation=auth,
...
)
```

## WS-Security X509-only authentication

```python
from workday.auth import WsSecurityCertificateAuthentication

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

client = workday.WorkdayClient(
authentiation=auth,
...
)
```

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

```python
from workday.auth import WsSecurityCertificateCredentialAuthentication

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

client = workday.WorkdayClient(
authentiation=auth,
...
)
```

# Example

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

```python

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

=======
History
=======

0.4.0 (2018-06-27)
------------------

* Implemented paging by making WorkdayResponse objects iterable

0.3.0 (2018-06-23)
------------------

* Added test framework, setup package for distribution

0.2.0 (2018-06-22)
------------------

* WS-Security support
* Protected WSDL support
* Paging support

0.1.0 (2018-06-22)
------------------

* First release on PyPI.
* Template for Talent API (SOAP) method execution


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

workday-0.4.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

workday-0.4.0-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file workday-0.4.0.tar.gz.

File metadata

  • Download URL: workday-0.4.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for workday-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c882b6c014b0db14fce0a66863e6f047477f787dafffcdeabd0083208807293c
MD5 cc65d356daa19db49f62c46ea6993cef
BLAKE2b-256 4c4cc488b0bcefdad0efcd70f8d0950f4aff18661ae4a3914de2c7fcbbe56b5f

See more details on using hashes here.

File details

Details for the file workday-0.4.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for workday-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 89eb255271f94c9d6d72d770c0cd2f9cc41ac10cbe8e2d14c95597e6bc2dd9f6
MD5 a5041c164219d24a811ba1ec67b50c98
BLAKE2b-256 5e0fca5f885801258f69bbf8bbb2a018e45982dc7394036a4c21164bcd8502c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page