Django (DRF) Serializers To Handle Nested JSON data

I have been dealing with a lot of JSON data more than ever before. All of the data are coming from a Webhook provider upon certain events. One of the things I was not comfortable with was the nested JSON structure until I found there is a clean way to solve it. Our Django app uses Django REST Framework (DRF) and relies heavily on its serialization capabilities. What are we going to see Looking at the data (JSON/dict) Looking at the model where the data is about to be stored Writing DRF serializer to handle the nested data More details of how its done using to_internal_value() conclusion A sample JSON data for context This is a webhook event when a charging session is started and stopped....

October 25, 2024 · 7 min

Python - A Clean Way to Traverse Nested Dict/List

I had to work with some complex structured JSON responses having multiple levels of nesting. The issue has always been that the API would return nested JSON where I have to walk different levels to get data by using x.get('y')[0].get... chains. For this very reason, I was looking for an optimal and efficient solution so that at least I can avoid calling get() many times. The Problem Let’s say you’re working with user data from an API:...

August 28, 2024 · 3 min

Auth0 as OpenIDC broker in AWS Cognito for AzureAD multi-tenancy support

If you read the previous article OAuth using AWS Cognito, then you should be also reading this. I’m writing this article after a month of this very story. But I believe I won’t miss much. SAML, OIDC setup and overview If we look into the out-of-the-box social identity providers , there are few. If we want to add Microsoft/Azure, that would be done via SAML or OpenID connect. Due to our client requirement, we started working on integrating Azure (now Entra) into Cognito via SAML....

March 24, 2024 · 5 min

Django OAuth setup with social login, AWS Cognito, GitHub - Full story

I spent some quality time researching about OAuth in Django. Tried more than 3 packages. Well, it was not just about just installing something and expect everything to work. There was some tinkering which i think i did well. Therefore, this some part of this blog might also help in your case i guess. I will be also uploading a YouTube video of the same, if i do, you can find the video at the bottom of this page....

January 25, 2024 · 12 min

Global variables in AWS λ are dirty!

Hello everyone, I know that it has been a long time since i wrote a post. I hope every thing is going well with you. I always wanted to consistently write here. But lets see if I can make it possible sometime soon :) What is this post about? Today, as usual i started off the job in the morning. I’m at a juncture point of building a part of the project....

November 1, 2023 · 4 min

POV: 'smart-work' over 'hard-work'

Let me start off by this simple quote: The Only Way to Do Great Work is To Love What You Do - Steve Jobs The best way to inherently learn more is by doing what you really like. Say it’s software dev, farming, carpentey or any task. If you enjoy/like it, you would love doing it and also learn from experience. This is what we already know. Our mind simply grasp things that we really like and if we put in more work in the same, we will become better on that....

August 28, 2022 · 6 min

what does the Bible say about jobs 👷‍♂️

Are you a wagie? Most probably you are unless you have some passive/active income from your product. Over the past decade, I’ve seen many people jumping from a mechanical engineer role to a software field. Reason is quite obvious. I don’t want to tell you that software industry now provides more employment. It’s really good if you enjoy it. What if you are not interested in but still working on it....

July 31, 2022 · 7 min

Introduction to Termux-API and script automation 🧑‍🔧

Welcome back to yet another amazing article. By the way, have you seen the new video uploaded at YT? This article is about about the same. Now, If you think about why do I write this blog after creating a video - well, a video is mostly a quick take (for me). We miss many things. Writing a blog mostly explains everything. Yes, now you have an idea about what I’m talking about....

July 1, 2022 · 4 min

I made my Resume from Markdown with CSS styles.

Hey all! welcome back to another article. I hope your week is going well. About me, I’ve had few wonderful stories to share with you, which is about a job interview that i had applied for. In the final round(HR)the story went twisty in many ways. So, I’ll share it another day. I’ve been so concerned about editing my resume. Up till last week, i was using Canva website to make my resume....

June 7, 2022 · 3 min

The movies promote cigrates with lung cancer notice.

May be I’m too distracted. But, Fu*k any movies, series or any such crap showing smoking and shamelessly says that it causes lung cancer. I’m not those “Social activists” or any such people who would raise arguments on any things others do. I don’t involve in anyone’s privacy. Because I’d like to give them their own space. But things like addiction is something someone don’t want instead mindlessly doing it....

May 28, 2022 · 3 min