A few years ago I have written a post on “How to create Custom endpoint in WooCommerce API“. That was I think for v3 of older WooCommerce. After that I did not get much time to work on WooCommerce products. But since then I was getting some queries on how to achieve the same forMore
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
Fetch Single Github File in Python
As I mentioned in the earlier post, I was recently working on a private project. We had to fetch single GitHub file from a private Github repository without hardcoding the token or setting it as environment variable. I could not easily find a ready solution. So prepared one. I am posting the solution here soMore
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