/RewstPy

Run Python natively in Rewst.

Primary LanguagePythonMIT LicenseMIT

Overview

Use this project and workflow to run raw Python directly in Azure Functions. This is similar to my RewstPS project.

Setup

  1. Fork this repository.

  2. Create a Function App in Azure. You'll want to the latest version of Python and Linux as your operating system..

  3. In your Function App in Azure, go to Deployment Center and connect it to the forked GitHub repository.

  4. In Overview, copy your URL. We'll use this later to setup our Custom Integration. It will look like the following: https://yourfunctionapp.azurewebsites.net/api/run.

  5. Navigate to your function app in Azure, then go to Overview. Under functions, click ScriptRunner.

  6. Under Function Keys, copy your default key. We'll also be using this in the Custom Integration.

  7. In Rewst, navigate to Configuration > Integrations > Custom Integrations. Add a new one called "Rewst Python" and match the settings below:

    Hostname API Key Authentication Method API Key Header Name
    yourfunctionapp.azurewebsites.net The key you copied API Key x-functions-key
  8. Import the run-python.bundle.json file as a new workflow.

  9. In the run_script action under Advanced, you may need to add an Integration Override for your new Rewst Python integration as well and then click publish.

Usage

  1. Create a Python script under Scripts in Rewst. If you want to return results, assign something to a variable named rewst_response.
  2. Open the Run Python workflow and click Test.
  3. For script content, enter select your test script.
  4. See your result in RESULT.result.

Packages

If you wish to use any packages, you'll need to put them in the requirements.txt file in your own repo.