Skip to main content
Question

VS Code - automation using tasks via Python and REST API - authentication question

  • December 11, 2025
  • 0 replies
  • 7 views

Johan Jacob
Forum|alt.badge.img+1

Hello,

We are in the process of automating a series of tasks in VS Code, in the tasks.json we defined a couple of tasks. Most of them are simple tasks, that can be executed by triggering a zowe command.
Example : 
{   
      "label": "01 Clone ZMF package to local Git Repo",
      "type": "shell",
      "command": "git",
      "args":[
        "clone",
        "ZMF://${input:zmfSubsys}/${input:zmfPackage}",
        "C:/Users/${env:USERNAME}/.zmfGitrepo/${input:zmfPackage}"
      ],
      "problemMatcher": [],
    },
or 
    {   
      "label": "04 Audit ZMF Package",
      "type": "shell",
      "command": "zowe",
      "args": [
        "changemanzmf",
        "audit",
        "package",
        "-p",
        "${input:zmfPackage}",
        "--zmf-p",
        "${input:zmfSubsys}",
        "--uv1",
        "CAUD"
      ],
      "problemMatcher": [],
    },
 

Now some of the tasks are more complex, where we need the execution of a REST API followed by data manipulations or multiple REST APIs to be executed to create a zowe comand (or a final REST API that will perform an action)
Example
    {   
      "label": "02 Create/Recreate ZMF Package zOpenEditor YAML file (SYSLIB)",
      "type": "shell",
      "command": "python",
      "args":[
       "-u",
       "C:/Users/${env:USERNAME}/.zmfPython/zmfZOpenEditorYaml.py",
       "--zmfPackage", "${input:zmfPackage}",
       "--zmfZoweProfile", "${input:zmfZoweProfile}",
       "--zmfUser", "${input:zmfUser}",
       "--zmfPswd", "${input:zmfPswd}"
      ],
      "problemMatcher": [],

    },

As you can see, here a python script is executed and the z/OS user and password are required as, we must authenticate in the REST API call.

    resp = requests.get(restApiUrl, auth=(user, pswd), headers=headers, timeout=10)

The problem however is that the password remains visible when executing the python script.

We would rather use the userid/password from the zowe profile, but I have tried in various ways and this seems not possible. We also don’t want to use  a task to create some encrypted file with the user/password

My question (s)
1. Is it possible to use the zowe token as authenticator

2. Is there another way to execute the REST API using a certificate

Thank you

Johan