Skip to main content

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

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 files
  --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


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.0.5.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

workfrontutil-0.0.5-py3-none-any.whl (13.5 kB view hashes)

Uploaded Python 3

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