Python Wrapper for the Workfront API
Project description
workfront-util
Simple Python library that can be used to retrieve data from the workfront api.
Easily return all data for any objCode from the workfront api.
This library uses asyncio under the hood to batch requests and return a list of dicts.
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
api = WorkfrontAPI(objCode= 'hour')
hours = api.return_all()
Control the results by configuring a workfront_util_settings.json file.
{
"workfront" : {
"environment": "prod",
"api_version": "9.0",
"filters": {
"hour" : {
"entryDate": "2019-07-01",
"entryDate_Mod": "between",
"entryDate_Range": "$$TODAYb"
}
},
"fields" : {
"hour" : "*"
}
}
OR Add your filter options and field selections inline if preferred.
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
settings = ENVSettings()
filter_option = {
"entryDate": "2019-07-01",
"entryDate_Mod": "between",
"entryDate_Range": "$$TODAYb"
}
api = WorkfrontAPI(
version = settings.api_version,
env= settings.env ,
fields = "*"
filter_option= filter_option,
objCode= 'hour')
hours = api.return_all()
Return a flat pandas dataframe by passing flat=true
hours = api.return_all(flat=True)
Run a CLI
Usage: workfrontutil [OPTIONS]
Options:
--make_config TEXT Generate config file
--config_path TEXT location of config file
--objCode TEXT Target objCode
--fields TEXT Target objCode fields to return
--filter TEXT Target objCode filter to use
--edit_config TEXT Update Config file
--save_obj TEXT Save all objCode data to DB
--help Show this message and exit.
#Getting Started
Install the package
pip install workforntutil
Run from the cli or import into your script
from workfrontutil import WorkfrontAPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
workfrontutil-0.1.0.tar.gz
(9.7 kB
view hashes)
Built Distribution
Close
Hashes for workfrontutil-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5ddd71070bf4a0d08d0da24e6e46ceb40e056c35ac6e09db89c62005efef894 |
|
MD5 | efba96841c8ad1fc08374169342c0ab5 |
|
BLAKE2b-256 | 49c13c0e08b2ee7afca25ae019ee87939efba7de94ea7b3ec62648f996c15b1f |