workday_tools


Nameworkday_tools JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryPython Tools for Workday Interactions RaaS/REST.
upload_time2024-12-12 21:48:38
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords workday raas rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Workday Tools

I use this to make REST calls to return RaaS data for further processing.
Initially, I also had SOAP but switched to the **workday** package. I may
add additional tools and don't want to change the code that uses this so 
keeping plural. 

## Workday Base URL

My primary goal when writing reusable code is to not force changes within
the code but rather within configuration files. To this end, pun intended
the endpoint URL is specified in a config file with credentials. This uses
basic auth, which isn't recommended. If I get a few requests, I can look into
updatign to additional methods. The test for with url to use is an if else
where the value must be **PROD** and is case-sensitive.

```yaml
environment: "PROD"
account: "ACCOUNT"
password: "PASSWORD"
tenant: "TENANT"
prod_url: "https://PROD_URL"
devel_url: "https://DEVEL_URL"
 ```

## Workday Application Configuration

I generally have a second configuration file for end points and often have
multiple reports pulled and combined. This is just as easy to include here 
if that's your preference but I like checking in the configuration files
as I keep passwords out of them. This is not required or used directly, 
but these values are passed to the REST call. Below is an example that takes
extra parameters. You can look all of this up by clicking on related actions
for a report and then down to **Web Service** and **View URLs**. This snippet
is in config.yaml.

```yaml
#
# RaaS Parameters
#
raas_config: workday.yaml
raas_report: "Distribution_Lists_Student"
raas_format: csv
raas_extra_params: '&Parmeter=1&...'
```
## Example (rest_call) 

The one required paramter is the report name to send. I always pull 
this from **View URLs** link to make it easy. The other parameters have 
examples. Although not needed it's handy if you make multiple rest calls 
or need to add this call frequently. I simply make the call from within
the app if working on a web app for example. 

I'll assume the above configuration exists for this example. This call has
a few defaults. The raas_config is workday.yaml if not provided. I have it 
included and pass to make it easier for the next person to follow along. 

The default raas_format is JSON, but it will pass whatever format you would
like if provided. They can be seen on the **View URLs** page.

The default value for extra params is **None** as well.

I import this snippet into code to make it easy to use RaaS data. I added a few
print statements to make it easier to follow along. I also setup logging in the
snippet, if needed and other house keeping.

```python
import os
import workday_tools_nosrednakram.RaaSRest

# Determine the base for config files
cfg_file_base = os.path.abspath(os.path.join(os.path.dirname(__file__), '.'))

def rest_call(report, extra_params=None, report_format='csv', raas_config="workday.yaml"):
    raas_endpoint = workday_tools_nosrednakram.RaaSRest.RaaSRest(config_file=os.path.join(cfg_file_base, raas_config))
    print(f'{__name__}: Report {report}')
    print(f'{__name__}: Extra Parameters {extra_params}')
    response = raas_endpoint.report(report=report, format=report_format)
    try:
        return response.text
    except:
        return None
```

This is generally called from within a larger application. It's included and 
in this case as it requests a csv returned is a text object that I will process.
This assumes configuration is loaded and correct. I left the loading of the file
as a csv into pandas as I use it frequently and it may be usefull to someone else. 

```python
from rest import rest_call
import pandas as pd
import yaml
from io import StringIO

try:
    with open('config.yaml', 'r') as stream:
        config = yaml.load(stream, Loader=yaml.Loader)
except Exception as e:
    print(f'Reading YAML Error: {e}')

try:
    rest_response = rest_call(report=config['raas_report'],
                              extra_params=config['raas_extra_params'],
                              report_format=config['raas_format'],
                              raas_config=config['raas_config'])

    in_csv = pd.read_csv(StringIO(rest_response))

except Exception as e:
    print(f'REST Error: {e}')
```

## Security

You'll need to be able to log in as an integrations system user (ISU) with an appropriate integration system security group (ISSG) to access the objet. We
needed to setup a user based security group that allows basic auth connections
to get this working. Reach out if you have questions. 

Depending on your policies it's also common to exempt the ISU from requiring
password reset, ***Maintain Password Rules**. I still change passwords at least
once a year but don't want a changed time out to kill applications. If there is
interest I can look at adding Oauth2. If interested please let me know.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "workday_tools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "workday, raas, rest",
    "author": null,
    "author_email": "Mark W Anderson <nosrednakram@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e3/f6/f1d7484b72fdb404b71de9398318a0de5049e4acd70f190919e90065b613/workday_tools-0.1.0.tar.gz",
    "platform": null,
    "description": "# Workday Tools\n\nI use this to make REST calls to return RaaS data for further processing.\nInitially, I also had SOAP but switched to the **workday** package. I may\nadd additional tools and don't want to change the code that uses this so \nkeeping plural. \n\n## Workday Base URL\n\nMy primary goal when writing reusable code is to not force changes within\nthe code but rather within configuration files. To this end, pun intended\nthe endpoint URL is specified in a config file with credentials. This uses\nbasic auth, which isn't recommended. If I get a few requests, I can look into\nupdatign to additional methods. The test for with url to use is an if else\nwhere the value must be **PROD** and is case-sensitive.\n\n```yaml\nenvironment: \"PROD\"\naccount: \"ACCOUNT\"\npassword: \"PASSWORD\"\ntenant: \"TENANT\"\nprod_url: \"https://PROD_URL\"\ndevel_url: \"https://DEVEL_URL\"\n ```\n\n## Workday Application Configuration\n\nI generally have a second configuration file for end points and often have\nmultiple reports pulled and combined. This is just as easy to include here \nif that's your preference but I like checking in the configuration files\nas I keep passwords out of them. This is not required or used directly, \nbut these values are passed to the REST call. Below is an example that takes\nextra parameters. You can look all of this up by clicking on related actions\nfor a report and then down to **Web Service** and **View URLs**. This snippet\nis in config.yaml.\n\n```yaml\n#\n# RaaS Parameters\n#\nraas_config: workday.yaml\nraas_report: \"Distribution_Lists_Student\"\nraas_format: csv\nraas_extra_params: '&Parmeter=1&...'\n```\n## Example (rest_call) \n\nThe one required paramter is the report name to send. I always pull \nthis from **View URLs** link to make it easy. The other parameters have \nexamples. Although not needed it's handy if you make multiple rest calls \nor need to add this call frequently. I simply make the call from within\nthe app if working on a web app for example. \n\nI'll assume the above configuration exists for this example. This call has\na few defaults. The raas_config is workday.yaml if not provided. I have it \nincluded and pass to make it easier for the next person to follow along. \n\nThe default raas_format is JSON, but it will pass whatever format you would\nlike if provided. They can be seen on the **View URLs** page.\n\nThe default value for extra params is **None** as well.\n\nI import this snippet into code to make it easy to use RaaS data. I added a few\nprint statements to make it easier to follow along. I also setup logging in the\nsnippet, if needed and other house keeping.\n\n```python\nimport os\nimport workday_tools_nosrednakram.RaaSRest\n\n# Determine the base for config files\ncfg_file_base = os.path.abspath(os.path.join(os.path.dirname(__file__), '.'))\n\ndef rest_call(report, extra_params=None, report_format='csv', raas_config=\"workday.yaml\"):\n    raas_endpoint = workday_tools_nosrednakram.RaaSRest.RaaSRest(config_file=os.path.join(cfg_file_base, raas_config))\n    print(f'{__name__}: Report {report}')\n    print(f'{__name__}: Extra Parameters {extra_params}')\n    response = raas_endpoint.report(report=report, format=report_format)\n    try:\n        return response.text\n    except:\n        return None\n```\n\nThis is generally called from within a larger application. It's included and \nin this case as it requests a csv returned is a text object that I will process.\nThis assumes configuration is loaded and correct. I left the loading of the file\nas a csv into pandas as I use it frequently and it may be usefull to someone else. \n\n```python\nfrom rest import rest_call\nimport pandas as pd\nimport yaml\nfrom io import StringIO\n\ntry:\n    with open('config.yaml', 'r') as stream:\n        config = yaml.load(stream, Loader=yaml.Loader)\nexcept Exception as e:\n    print(f'Reading YAML Error: {e}')\n\ntry:\n    rest_response = rest_call(report=config['raas_report'],\n                              extra_params=config['raas_extra_params'],\n                              report_format=config['raas_format'],\n                              raas_config=config['raas_config'])\n\n    in_csv = pd.read_csv(StringIO(rest_response))\n\nexcept Exception as e:\n    print(f'REST Error: {e}')\n```\n\n## Security\n\nYou'll need to be able to log in as an integrations system user (ISU) with an appropriate integration system security group (ISSG) to access the objet. We\nneeded to setup a user based security group that allows basic auth connections\nto get this working. Reach out if you have questions. \n\nDepending on your policies it's also common to exempt the ISU from requiring\npassword reset, ***Maintain Password Rules**. I still change passwords at least\nonce a year but don't want a changed time out to kill applications. If there is\ninterest I can look at adding Oauth2. If interested please let me know.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python Tools for Workday Interactions RaaS/REST.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "workday",
        " raas",
        " rest"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fc203c7006f13bc5d1a036a6350a961c970c8598da838dfd7fabe0d3d3840946",
                "md5": "779ac87babdbd3c1a7bb011a232311bd",
                "sha256": "e26f1dc6716c6c966f8491876cb2d27a19821575238a537ad21c9a8c8a86a1ee"
            },
            "downloads": -1,
            "filename": "workday_tools-0.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "779ac87babdbd3c1a7bb011a232311bd",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 6018,
            "upload_time": "2024-12-12T21:48:35",
            "upload_time_iso_8601": "2024-12-12T21:48:35.291148Z",
            "url": "https://files.pythonhosted.org/packages/fc/20/3c7006f13bc5d1a036a6350a961c970c8598da838dfd7fabe0d3d3840946/workday_tools-0.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e3f6f1d7484b72fdb404b71de9398318a0de5049e4acd70f190919e90065b613",
                "md5": "6e4fcc98e2adeff550ffd60d4720ac0f",
                "sha256": "57609121ac0b839586cd74bfff94b9048c40f8de0becc45b8e2caf7af3616503"
            },
            "downloads": -1,
            "filename": "workday_tools-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6e4fcc98e2adeff550ffd60d4720ac0f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5783,
            "upload_time": "2024-12-12T21:48:38",
            "upload_time_iso_8601": "2024-12-12T21:48:38.351981Z",
            "url": "https://files.pythonhosted.org/packages/e3/f6/f1d7484b72fdb404b71de9398318a0de5049e4acd70f190919e90065b613/workday_tools-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-12 21:48:38",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "workday_tools"
}
        
Elapsed time: 0.69296s