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


Download files

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

Files for workfrontutil, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size workfrontutil-0.1.0-py3-none-any.whl (13.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size workfrontutil-0.1.0.tar.gz (9.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page