Posts

Web App Development Using Python and Flask Part 01

Image
Hello Friends. As I have mentioned in my last post, we are going to learn how to create a simple Web App using Python and Flask. If you have not visited my posts on Python and Flask, please find the links below - 1.  Python and Flask Part 01 2.  Python and Flask Part 02 Even in this tutorial, we'll use the Flask framework, as we did so far, to create our simple web application. Let's get started. We can find below components in a typical web application - 1. Static images and HTML pages 2. CSS 3. Dynamic Contents 4. Form submit/actions 5. DB Integration In this tutorial we are going to learn how to setup a web application and how to handle the form submit. First, we'll create a directory structure for our web application. Please setup the directory structure as shown below - Directory Structure Here, Pixie Dust is my root directory. Under it, we have directories static and webpage. In static we have directories css and images. My app.py file is in the root directory, Pixie

RESTful APIs with Python and Flask : Part 2

Image
 Hello Friends, Welcome back !!! In my last blog we saw that how we can setup a RESTful API using Python and Flask framework. We also learned how to pass request params from client to the API call and receive it at server side. Continuation on the same, today we are going to learn how to create POST API call and pass the JSON request to it. We'll use a tool call POSTMAN to hit the POST API. If you don't have it, you can install it from below link - https://www.postman.com/downloads/ Ok, let's get started. I am assuming that you have already gone through my earlier blog and have created the directory structure for this project. If not, then please go through it and create the app.py file.  https://diwakarsinhalearn.blogspot.com/2021/02/restful-apis-with-python-and-flask-part.html Step 01 : In the app.py file, please add the below code. @app.route ( "/employee" , methods =[ "POST" ]) def employee(): data = request.get_json() if data: name =

RESTful APIs with Python and Flask : Part 01

Image
Hello Friends !!!  Welcome to this blog in which we will learn how to create RESTful APIs using Python and Flask. Python is a very simple programming language with lots of rich and powerful libraries to implement your business logic. Flask is a Python web framework which provides the facility to expose the RESTful services. In this tutorial we'll use this framework to implement the APIs. PREREQUISITE - Skill set needed for this tutorial : Basic Python understanding and familiarity with RESTful services Python Setup : Python should be install. To verify if Python is install or not please run the below command on the console - $ python --version Python 2.7.10 Above will be the output when Python is install on your m/c. Flask Setup : To install Flask please run below command on the console - $ pip install Flask Successfully installed Flask-1.1.2  .............. Above will install Flask on your m/c. IDE : Pycharm can be used as the IDE. Let's get started. SIMPLE GET REQUEST Step 0