Workday租户的Python客户端
项目描述
# Python for Workday
This is a Python client (2.7 or 3.4+) for communicating with one of the Workday XML/SOAP APIs.
[](https://badge.fury.io/py/workday)
[](https://travis-ci.cn/tonybaloney/workday)
[](https://github.com/ambv/black)
# 特性
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
# 配置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()
```
调用API方法将返回`workday.client.WorkdayResponse`的一个实例。
如果您想分页显示结果,`WorkdayResponse`实例是可迭代的,例如:
```python
results = []
for certs in client.talent.Get_Certifications(): # 遍历所有可用页面
results.extend(certs.data['Certification'])
print(results)
```
数据将位于任何API响应的`data`属性中。
## 认证示例
所有认证方法都在`workday.auth`模块中,并且它们的实例应该作为`authentication`参数传递给`WorkdayClient`构造函数。
## 无认证
```python
from workday.auth import AnonymousAuthentication
anon = AnonymousAuthentication()
client = workday.WorkdayClient(
authentiation=anon,
...
)
```
## WS-Security用户名/密码
```python
from workday.auth import WsSecurityCredentialAuthentication
auth = WsSecurityCredentialAuthentication('my_user@tenant_name', 'mypassword')
client = workday.WorkdayClient(
authentiation=auth,
...
)
```
## WS-Security仅X509认证
```python
from workday.auth import WsSecurityCertificateAuthentication
auth = WsSecurityCertificateAuthentication('/path/to/private.key', '/path/to/public.key')
client = workday.WorkdayClient(
authentiation=auth,
...
)
```
## WS-Security仅X509签名凭据(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,
...
)
```
## 示例
这个简单的示例返回一个字典列表,该列表来自为每个配置的语言配置的Workday API。
```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)
```
## 贡献
此模块由Anthony Shaw在Dimension Data编写
## 贡献
欢迎贡献。请参阅CONTRIBUTING.rst
=======
历史记录
=======
0.4.0 (2018-06-27)
------------------
* 通过使WorkdayResponse对象可迭代实现了分页
0.3.0 (2018-06-23)
------------------
* 添加了测试框架和用于分发的设置包
0.2.0 (2018-06-22)
------------------
* 支持WS-Security
* 支持受保护的WSDL
* 支持分页
0.1.0 (2018-06-22)
------------------
* 第一个PyPI发布版本。
* 人才API(SOAP)方法执行的模板
This is a Python client (2.7 or 3.4+) for communicating with one of the Workday XML/SOAP APIs.
[](https://badge.fury.io/py/workday)
[](https://travis-ci.cn/tonybaloney/workday)
[](https://github.com/ambv/black)
# 特性
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
# 配置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()
```
调用API方法将返回`workday.client.WorkdayResponse`的一个实例。
如果您想分页显示结果,`WorkdayResponse`实例是可迭代的,例如:
```python
results = []
for certs in client.talent.Get_Certifications(): # 遍历所有可用页面
results.extend(certs.data['Certification'])
print(results)
```
数据将位于任何API响应的`data`属性中。
## 认证示例
所有认证方法都在`workday.auth`模块中,并且它们的实例应该作为`authentication`参数传递给`WorkdayClient`构造函数。
## 无认证
```python
from workday.auth import AnonymousAuthentication
anon = AnonymousAuthentication()
client = workday.WorkdayClient(
authentiation=anon,
...
)
```
## WS-Security用户名/密码
```python
from workday.auth import WsSecurityCredentialAuthentication
auth = WsSecurityCredentialAuthentication('my_user@tenant_name', 'mypassword')
client = workday.WorkdayClient(
authentiation=auth,
...
)
```
## WS-Security仅X509认证
```python
from workday.auth import WsSecurityCertificateAuthentication
auth = WsSecurityCertificateAuthentication('/path/to/private.key', '/path/to/public.key')
client = workday.WorkdayClient(
authentiation=auth,
...
)
```
## WS-Security仅X509签名凭据(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,
...
)
```
## 示例
这个简单的示例返回一个字典列表,该列表来自为每个配置的语言配置的Workday API。
```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)
```
## 贡献
此模块由Anthony Shaw在Dimension Data编写
## 贡献
欢迎贡献。请参阅CONTRIBUTING.rst
=======
历史记录
=======
0.4.0 (2018-06-27)
------------------
* 通过使WorkdayResponse对象可迭代实现了分页
0.3.0 (2018-06-23)
------------------
* 添加了测试框架和用于分发的设置包
0.2.0 (2018-06-22)
------------------
* 支持WS-Security
* 支持受保护的WSDL
* 支持分页
0.1.0 (2018-06-22)
------------------
* 第一个PyPI发布版本。
* 人才API(SOAP)方法执行的模板
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
workday-0.4.0.tar.gz (1.0 MB 查看哈希)
构建分布
workday-0.4.0-py2.py3-none-any.whl (8.6 kB 查看哈希)