Playing with Python

At work we have some dedicated time each week to learning new things or improve on old things, and earlier this week I had randomly read some stuff about Python. Since I have never gotten my hands dirty with Python I decided that it was time to change that.

I started out by following this guide to install Python in my VS Code environment and played a bit with the examples provided.

Then I decided to write a function to base64 encode username and password to be used for basic auth, just to see if I could:

import base64

EncodingAsString = "utf-8"
BasicPrefix = "Basic"

def GetBasicAuth(username, password):

    encodedString = str(base64.b64encode(str(f"{username}:{password}").encode(EncodingAsString)), EncodingAsString)

    return str(f"{BasicPrefix} {encodedString}")

print(GetBasicAuth("ebolakid", "blog"))

I guess it turned out alright for being written 15 minutes after a Python installation.

EDIT: Please note that the intendation didn’t quite fit the blog…
But copy-paste into your favorite editor should work just fine.

Stop a triggered Azure WebJob

In a post way back here I wrote about temporarily stopping all Azure WebJobs within an Azure Web App. Single continuous WebJobs can be stopped manually one by one in the Azure Portal, but what about stopping a triggered WebJob?

After doing some research, and with that I mean stopping one of the triggered WebJobs in our test environment, I came to the conclusion that using the setting “WEBJOBS_DISABLE_SCHEDULE” and set the value to 1 does the trick without any fuzz.