Home » Python

Python

Part 3: Flask API Decorators and Helpers

This is the third of three posts about building a JSON API with Flask. Make sure you start with part 1 and part 2. In the first post, we used a custom base SQLAlchemy class to serialize and deserialize database models to and from JSON. The second post created a RESTful API listing and updating users. Now we’re ready for ...

Read More »

Part 2: Building a Flask RESTful API

This is the second of three posts about building a JSON API with Flask. Part 1 arrived yesterday and part 3 is arriving tomorrow. In the previous post we learned how to serialize SQLAlchemy models to/from JSON. Now let’s use that to build a RESTful JSON API with Flask. What is a RESTful API A RESTfu API is a website ...

Read More »

Part 1: SQLAlchemy Models to JSON

This is the first of three posts about building a JSON API with Flask. Part 2 and part 3 arrive tomorrow and the day after. I’ve seen a lot of questions on StackOverflow about how to turn SQLAlchemy models into JSON. When building a JSON API with Flask and SQLAlchemy, you end up writing a lot of boilerplate api code ...

Read More »

Fixtures in PyTest

1. Introduction PyTest is used for developing automation tests using python. It is a very powerful framework that can be utilized to write effective test automation scenarios in python. PyTest framework makes it easy to write small tests, yet scalable, to support complex applications and libraries. 2. PyTest fixtures The purpose of test fixtures is to provide an inbuilt baseline ...

Read More »

Yelp: Reverse geocoding businesses to extract detailed location information

I’ve been playing around with the Yelp Open Dataset and wanted to extract more detailed location information for each business. This is an example of the JSON representation of one business: $ cat dataset/business.json | head -n1 | jq { "business_id": "FYWN1wneV18bWNgQjJ2GNg", "name": "Dental by Design", "neighborhood": "", "address": "4855 E Warner Rd, Ste B9", "city": "Ahwatukee", "state": "AZ", "postal_code": ...

Read More »

“Cook” it and “Pre Hook” it

“Cook” it and “Hook” it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it’s been a long while I have set hands on my site writing again. Well, I was having a group training session in my organization where my fellow colleague Bony Roopchandani who explained us the concepts of “Hook” and the ...

Read More »

Python GUI Examples (Tkinter Tutorial)

In this tutorial, we will learn how to develop graphical user interfaces by writing some Python GUI examples using Tkinter package. Tkinter package is shipped with Python as a standard package, so we don’t need to install anything to use it. Tkinter package is a very powerful package. If you already have installed Python, you may use IDLE which is ...

Read More »

Exploring Security, Metrics, and Error-handling with gRPC in Python

In my post “Using gRPC in Python,” we wrote a basic gRPC server implementing a users service. We are going to expand on it and explore more gRPC concepts, such as secure client-server communication via self-signed SSL certificates, implementing gRPC middleware (or interceptors), and error handling. We will be using Python 3.6 for our demos in this article. The git ...

Read More »