Boto3 Single Session across the project

How to create a single boto3 session and use it across a python project? Here is the solution: Create session.py Paste the following code: import boto3 import os class Session: session = None def __init__(self): self.get_session() @classmethod def get_session(cls): if cls.session is None: cls.session = cls.start_session() return cls.session @staticmethod def start_session(): if ‘AWS_ROLE_ACCESS_KEY’ in os.environ:More

Recursive merge dictionaries – Python

I recently worked on a python project and noticed a situation where I needed two dictionaries to be merged recursively. There were some easy and simple solutions, but they would not have expected results or the dictionaries were not merged recursively or merged dicts would not properly override values. So I thought to write oneMore