Building Restful API with Flask, Postman & PyTest - Part 2 (Read Time: 10 Mins) -

Building Restful API with Flask, Postman & PyTest - Part 2 (Read Time: 10 Mins) -

Today we shall cover the creation of mock endpoints in Postman. To help in the designing &amp; prototyping of API endpoints for the&nbsp;<strong>expense manager</strong>project using&nbsp;<strong>Flask</strong>&nbsp;and&nbsp;<strong>pytest</strong>&nbsp;in part 3.

Introduction

Today we shall cover the creation of mock endpoints in Postman. To help in the designing & prototyping of API endpoints for the expense managerproject using Flask and pytest in part 3.

For those that are new to this series, you can go to part 1 to understand the explanation of tools and libraries used for this series to create API endpoints in Flask.

You are encouraged to jump between each tutorial sections. I had included this postman collection to get you started to play around with mock endpoints.
Tools* Postman
Project Specification
The expenses manager has to have the following features for the API endpoints:

  • Postman
    Why Create Mock APIs Instead of Building the API?
    The reason for it is to help in the prototyping process of developing the endpoints.

By creating prototypes, you gain the perspective on how to create the endpoints and see on how it will look like in the final product.
Using your Prototype to Gain Understanding & Common Ground
With the use of the prototypes, it allows you to communicate your understanding and get feedback to make changes before you start in developing the actual product.
Breaking Dependence of Front-end & Back-end
Through the creation of mock endpoints in postman, you break the inter-dependency issue that you might encounter with the front-end developers regarding on APIs.

There is always a problem in having the API endpoint to be operating 24/7 to test out your front-end's UI or the API you had built when you're moving at a fast pace.

Fortunately, with the creation of mock endpoints in Postman, it had made it easier to collaborate at a much faster pace.
Creating a Postman Collection
Before you start on creating mock endpoint you have to sign up for a postman account.

Once had created your new account, download the postman app in your os.

Create a new postman collection called Expenses Manager. A postman collection is a place to store your API request in postman.

Creating a Mock Server In Postman
Now in your newly created Postman collection, click on the ">" icon and select the mocks tab.

There will be a button that says create a mock server click on that button to create a mock server as shown in the picture below.

Select the default settings and click create button as shown below.

With a mock server URL for your postman collection, you need to enable the Expenses Manager environment to use the mock server.

Enabling the Postman Environment

To enable the Postman, go to your top right corner just beside the icon with an eye.

Click a dropdown box with the name No Environment. Select Expenses Manager environment.

Select eye icon, it will show you the mock server's link under the local environment variable called url.

The variable allows you to create API points without the need to replace the URL of each request which saves you time.

Creating A New Request
Now we shall proceed in setting your first request in postman. Select your "Expenses Manager" collection and click on the "..." button that is at the bottom of the arrow button.

Once you had click on the button, a list of options is displayed then click on Add Request as shown in the picture below.

From there enter the name of your new request called Get List of Transactions and save it to the expenses manager collection.

Editing the Description of a Request

Let's add descriptions to the request, click on arrow icon and then edit icon as shown below.

The description will become part of automatically created documentation. Therefore it is useful to add it in to explain what does the API do.

API Description: Get the list of transactions in the expenses manager

List of API Requests in Postman
In RESTful API, there are a bunch of HTTP methods for different use cases.

You could get the list of methods founded by clicking on the arrow button of the GET method in your request.

Types of API Request Methods

Here are the HTTP methods that you will use for this expanses manager project or future APIs that you will be creating.

They follow a similar structure to the CRUD function of the typical database.

They are as follows:

Edit Get List of Transactions Request

Now go to List of Transactions Request and enter the following URL.

{{url}}/transactions/

The

{{url}}

represents the mock server URL.
Duplicate the API Requests
Duplicate the following request shown in the picture.

Creating an Example Response
An example response is a mock response whenever you send an HTTP request.

Select the Get List of Transactions request and add a new example response.

Once you had created a new example, you will be shown the example response message as shown below.

Replace the name with Success Response and enter the body of the response shown below.

{
    "balance": 200,
    "transactions": [
        {
            "id": 1,
            "amount": "60",
            "description": "New jeans",
            "type": "expense",
            "inital_balance": 300,
            "current_balance": 240,
            "time": "2019-01-12 09:00:00"
        },
        {
            "id": 2,
            "amount": "40",
            "description": "Lunch at a restaurant",
            "type": "expense",
            "inital_balance": 240,
            "current_balance": 200,
            "time": "2019-01-12 12:00:00"
        },
        {
            "id": 3,
            "amount": "10",
            "description": "Tips",
            "type": "income",
            "inital_balance": 200,
            "current_balance": 210,
            "time": "2019-01-12 16:00:00"
        },
        {
            "id": 4,
            "amount": "10",
            "description": "Weekly bus pass",
            "type": "expense",
            "inital_balance": 210,
            "current_balance": 200,
            "time": "2019-01-12 18:00:00"
        }
    ]
}

Add Status Code

The status code is used to identify that an HTTP request to a server is successful. The most common type of HTTP status code is 404 which displays when there is no webpage for a website.

At the status dropdown box, you can select the status code for the example response which in this case is 200.

Now when you click on the send button on your Get List of Transactionsrequest.

You will be displayed the example response that you had created earlier.

Congratulations, you had created your first mock endpoint!!!

Now please create the remaining mock endpoints for the expenses manager project and test it out on your own.

I had included the Postman collection for the Expanses Manager. If your feeling lazy to play around with the mock endpoints, don't worry I won't tell anyone.

Expanses Manager Postman Collection
Conclusion
I hope that with your new founded skills in creating mock endpoints in postman. It can help you greatly in reducing the dependency between your front-end and the APIs you build.

Lastly, did you remember that you added the description of your API request?

Well, all Postman collections come with API documentation page that displays all your API requests and example responses for each API.

Having great API documentation is one of the keys to adopting APIs be it for internal, external or public use cases.

So, postman, have you covered in creating these documentations without spending any of your time writing it.

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Description
Learn Hands-On Python Programming By Creating Projects, GUIs and Graphics

Python is a dynamic modern object -oriented programming language
It is easy to learn and can be used to do a lot of things both big and small
Python is what is referred to as a high level language
Python is used in the industry for things like embedded software, web development, desktop applications, and even mobile apps!
SQL-Lite allows your applications to become even more powerful by storing, retrieving, and filtering through large data sets easily
If you want to learn to code, Python GUIs are the best way to start!

I designed this programming course to be easily understood by absolute beginners and young people. We start with basic Python programming concepts. Reinforce the same by developing Project and GUIs.

Why Python?

The Python coding language integrates well with other platforms – and runs on virtually all modern devices. If you’re new to coding, you can easily learn the basics in this fast and powerful coding environment. If you have experience with other computer languages, you’ll find Python simple and straightforward. This OSI-approved open-source language allows free use and distribution – even commercial distribution.

When and how do I start a career as a Python programmer?

In an independent third party survey, it has been revealed that the Python programming language is currently the most popular language for data scientists worldwide. This claim is substantiated by the Institute of Electrical and Electronic Engineers, which tracks programming languages by popularity. According to them, Python is the second most popular programming language this year for development on the web after Java.

Python Job Profiles
Software Engineer
Research Analyst
Data Analyst
Data Scientist
Software Developer
Python Salary

The median total pay for Python jobs in California, United States is $74,410, for a professional with one year of experience
Below are graphs depicting average Python salary by city
The first chart depicts average salary for a Python professional with one year of experience and the second chart depicts the average salaries by years of experience
Who Uses Python?

This course gives you a solid set of skills in one of today’s top programming languages. Today’s biggest companies (and smartest startups) use Python, including Google, Facebook, Instagram, Amazon, IBM, and NASA. Python is increasingly being used for scientific computations and data analysis
Take this course today and learn the skills you need to rub shoulders with today’s tech industry giants. Have fun, create and control intriguing and interactive Python GUIs, and enjoy a bright future! Best of Luck
Who is the target audience?

Anyone who wants to learn to code
For Complete Programming Beginners
For People New to Python
This course was designed for students with little to no programming experience
People interested in building Projects
Anyone looking to start with Python GUI development
Basic knowledge
Access to a computer
Download Python (FREE)
Should have an interest in programming
Interest in learning Python programming
Install Python 3.6 on your computer
What will you learn
Build Python Graphical User Interfaces(GUI) with Tkinter
Be able to use the in-built Python modules for their own projects
Use programming fundamentals to build a calculator
Use advanced Python concepts to code
Build Your GUI in Python programming
Use programming fundamentals to build a Project
Signup Login & Registration Programs
Quizzes
Assignments
Job Interview Preparation Questions
& Much More

Guide to Python Programming Language

Guide to Python Programming Language

Guide to Python Programming Language

Description
The course will lead you from beginning level to advance in Python Programming Language. You do not need any prior knowledge on Python or any programming language or even programming to join the course and become an expert on the topic.

The course is begin continuously developing by adding lectures regularly.

Please see the Promo and free sample video to get to know more.

Hope you will enjoy it.

Basic knowledge
An Enthusiast Mind
A Computer
Basic Knowledge To Use Computer
Internet Connection
What will you learn
Will Be Expert On Python Programming Language
Build Application On Python Programming Language

Python Programming Tutorials For Beginners

Python Programming Tutorials For Beginners

Python Programming Tutorials For Beginners

Description
Hello and welcome to brand new series of wiredwiki. In this series i will teach you guys all you need to know about python. This series is designed for beginners but that doesn't means that i will not talk about the advanced stuff as well.

As you may all know by now that my approach of teaching is very simple and straightforward.In this series i will be talking about the all the things you need to know to jump start you python programming skills. This series is designed for noobs who are totally new to programming, so if you don't know any thing about

programming than this is the way to go guys Here is the links to all the videos that i will upload in this whole series.

In this video i will talk about all the basic introduction you need to know about python, which python version to choose, how to install python, how to get around with the interface, how to code your first program. Than we will talk about operators, expressions, numbers, strings, boo leans, lists, dictionaries, tuples and than inputs in python. With

Lots of exercises and more fun stuff, let's get started.

Download free Exercise files.

Dropbox: https://bit.ly/2AW7FYF

Who is the target audience?

First time Python programmers
Students and Teachers
IT pros who want to learn to code
Aspiring data scientists who want to add Python to their tool arsenal
Basic knowledge
Students should be comfortable working in the PC or Mac operating system
What will you learn
know basic programming concept and skill
build 6 text-based application using python
be able to learn other programming languages
be able to build sophisticated system using python in the future

To know more: