Now that we have a running environment that's ready to run our scripts, let's create a very basic script to take a look at how it works:
print('Content-Type: text/plain')
print('')
print('Hello, world!')
On IDLE, we type the preceding code and save it as a Python file (such as testscript.py). Now, as we discussed earlier, for our web reference we mapped a physical directory or location in IIS. The newly created testscript.py needs to be in that folder to be accessible from the web.
The output of the web based URL call for Python script is as follows:
- As we can see in the preceding screenshot, the script is now called from the browser using the localhost URL. The output is a simple Hello, world ! that was called to be printed in script code.
- Additionally, the value Content-Type: text/plain specifies...