Loading...

Running Python from the Cloud in 3 Minutes

By Team WayScript

From increasing productivity to minimizing data loss, running programs on the cloud comes with many advantages. With WayScript, you can run Python programs from the cloud and further customize them to carry out other functions.

Tutorial

For this tutorial, we will be using an example Python program that generates a random Game of Thrones GIF when run.

The script uses Giphy's API and can be found here.

The API is used through a third party library called Requests.

This is the program we will be running from the cloud:

Now that we have our Game of Thrones GIF generator program ready, we will create a new program on WayScript to run this program on the cloud. In addition, we will be making minor but useful modifications to the program. For example, we will have the random GIF emailed to us.

Step One - Input Your Program

Build a program from scratch and drag the 'Python' module into to the first step of your program.

Paste your code into the module.

Step Two - Create Outputs

For our program to send us the email of the generated GIF, we're going to need to create a variable that contains the URL of the GIF. Instead of printing the URL, we're going to make it an output so that the URL can be used by other modules of our WayScript program.

I will replace the last line of code in the program with a line that stores the URL as an output.

As you can see, when the code is run, it now stores the URL as a variable to be used.

Step Three - Add An Email Module

Since we want the GIF emailed to us, we're going to add in the Gmail module to our recipe.

In the 'Inputs' section, we will be entering the content of our email. We can embed the GIF into the body of the email by using the image tag with the link of the GIF as our source.

Writing "[url]" as your image source will use the link contained in your url variable that you created before.

Step Four - Run Your Program

The program is now complete. Upon hitting 'Run Program', an email containing a random Game of Thrones GIF will be sent to the designated receiving address in the Gmail module.

Congratulations! You have successfully run a Python program from the cloud.