Hello! I’m Aaron 👋

Flask Login with Email instead of UserID

Implementing the timeout I was looking for an easy way to override the default behaviour in Flask which is to use the UserID field to login to a web app using Flask Login. I put together multiple different examples to get the following code: class User(UserMixin): def __init__(self, email, password): self.email = email self.password = password def get_id(self): return self.email This code overrides the default ‘User’ class in Flask Login, by extending the Usermixin object to define it’s own get_id method to return the email address, rather than a UserID....

March 12, 2023 Â· 2 min Â· Me

Creating and managing EC2s using Python: Creating an EC2 instance and accessing it via SSH

Creating and managing EC2s using Python: Creating an EC2 instance and accessing it via SSH In my endeavours to see a valid, up to date tutorial on using and managing EC2s using Python3 and Boto3 I failed to find much out there. Understanding the EC2 creation paradigm In order to create an EC2 instance in boto3, you have to understand what are the key elements. The first key element to creating an ec2 instance in code is making sure the security group is configured, using this code snippet:...

February 1, 2023 Â· 4 min Â· Me

Creating and managing VPCs using Python: part 1 - VPC Creation

Infrastucture as Code using Python 3: part 1 creating and managing VPCs In my endeavours to see a valid, up to date tutorial on using and managing VPCs using Python3 and Boto3 I failed to find much out there. The key parts to a working VPC The key parts for a practical and working VPC is the following: Reasonable Internet Gateway Route Table Any peering connections Full example Here is a full example snippet of creating a VPC from scratch below:...

January 31, 2023 Â· 3 min Â· Me

How to upload to a Flask server via Multipart Upload

Implementing the Server Unable to find a simple example of a Javascript client and Python server to implement a multipart upload, I decided to create my own. This was due to the way that Squid web proxy expects multipart uploads to be implemented for larger files, which is useful for sending files to be AV scanned or CDR applied via ICAP. This is a short example to show it working in 2022....

May 15, 2022 Â· 4 min Â· Me

Getting multiple host adapter IP addresses in Python

Introd Hunting around on google revealed very little on accessing the hosts IP address using Python, especially when it comes to accessing multiple IPs. Thankfully, the answer is simple Using ifaddr Downloading and installing ifaddr is super simple, which is nice compared to some other more complex libraries such as netiface that requires the C++ build tools. After installing ifaddr it really is as simple as the following code to go grab all the IP addresses on the device itself:...

April 15, 2022 Â· 1 min Â· Me