---
title: Build a CLI application with Python and Typer - Best Software Development Team Extension Partner for Nordics
description: CLI applications are ubiquitous and we are using them every day whether it be Git, Curl, or Pip. In this blog, I will show you how to build a Site
image: https://www.craftsmensoftware.com/hubfs/Build%20a%20CLI%20pipeline.webp
---

[Skip to main content](https://www.craftsmensoftware.com/blog/build-a-cli-application-with-python-and-typer#main-content)

[![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png)](https://www.craftsmensoftware.com)

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)

Open main navigation

Close main navigation

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)
- [Get In Touch](https://www.craftsmensoftware.com/contact-us)

[Get In Touch](https://www.craftsmensoftware.com/contact-us)

## Build a CLI application with Python and Typer

![Build a CLI application with Python and Typer](https://www.craftsmensoftware.com/hs-fs/hubfs/Build%20a%20CLI%20pipeline.webp?width=1200&height=820&name=Build%20a%20CLI%20pipeline.webp)

CLI applications are ubiquitous and we are using them every day whether it be **Git**, **Curl**, or **Pip**. In this blog, I will show you how to build a **Site Connectivity Checker** using Python and Typer.  
Typer is a fantastic library for quickly building CLI apps using Python’s standard type hints. It’s written by the same author of [FastAPI](https://fastapi.tiangolo.com/) – Sebastián Ramírez.

## Overview

- - Our application will make `GET` requests to the URLs provided by the users as a space-separated string or in a file, and display results.

- - By default, the app will make blocking requests with the help of the `requests` library.

- - We’ll make asynchronous requests to make our app faster with the `aiohttp` library.

## URL Retriever

Users of our application can input URLs either as a space-separated string or in a file. Let’s implement the functions necessary to parse the URLs.

#### URLs from string

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/PODzpKd-1-1024x342.png?width=1024&height=342&name=PODzpKd-1-1024x342.png)

#### URLs from file

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/Spyt7nB-1-1024x504.png?width=1024&height=504&name=Spyt7nB-1-1024x504.png)

## Blocking HTTP Requests

By default, our application will make blocking HTTP requests with the `requests` library. Let’s write our code for this default behavior.

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/JHPXDht-1-1024x589.png?width=1024&height=589&name=JHPXDht-1-1024x589.png)

#### Progressbar

You can display the progress of any time-consuming operations using the `typer.progressbar`.

## Non-blocking HTTP Requests

For multiple websites, blocking HTTP request is a very time-consuming process. Instead we can do better with the help of `aiohttp`. Our application will perform asynchronous requests if the `--a` option is supplied. Let’s write some functions to facilitate non-blocking HTTP requests.  
![](https://www.craftsmensoftware.com/hubfs/Imported_Blog_Media/RSaLNJz.png)

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/RSaLNJz-1-1024x678.png?width=1024&height=678&name=RSaLNJz-1-1024x678.png)

## Displaying the results

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/0CzSKtT-1-1024x427.png?width=1024&height=427&name=0CzSKtT-1-1024x427.png)

#### Printing with Echo

You can use `typer.echo()` to print to the screen. It’s recommended to use `echo()` instead of the standard `print()` function.

## Enter main()

Let’s dive deep into the entry point of our app – the `main`.

![](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/8mWky1s-1-1024x776.png?width=1024&height=776&name=8mWky1s-1-1024x776.png)

**CLI options**

We have three CLI options, namely `--urls`, `--file` and `--a`.

- - If you supply `--urls`, the app will parse the URLs from the given string.

- - If you supply `--file`, the app will read all the URLs in that file.

- - If the `--a` flag is enabled, the app will make asynchronous HTTP requests.

- - The order of options does not matter.

## Running our application

To run the app with a bunch of URLs separated by space, use the following command:

 python cli-app/main.py --urls "https://google.com https://facebook.com" 

 Copy

```
By default, the app will make blocking HTTP requests.If you want to make non-blocking requests, supply the --a flag.
```

## python cli-app/main.py --urls "https://google.com https://facebook.com" --a

 Copy

 

If you want your app to read URLs from a file, just pass the `--file` option. You can also provide both `--urls` and `--file` options to allow your app to retrieve URLs from the given string and the file. 

 

## python cli-app/main.py --file "cli-app/urls.txt" --urls "https://google.com https://facebook.com" -a

 Copy

![Saimon hossain](https://www.craftsmensoftware.com/hs-fs/hubfs/Saimon%20hossain.png?width=120&height=120&name=Saimon%20hossain.png)

Author: **[Saimon hossain](https://www.craftsmensoftware.com/blog/author/saimon-hossain)**  
 18/09/2023

 Software Development Engineer

![Hire AI-Native Engineers](https://www.craftsmensoftware.com/hubfs/Z63_3132.webp)

## Hire AI-Native Engineers

[![Book A Strategy Call](https://www.craftsmensoftware.com/hubfs/Book%20A%20Strategy%20Call.svg)](https://www.craftsmensoftware.com/contact-us)

### **About Craftsmen**

[The Team](https://www.craftsmensoftware.com/about-us)

[Our Partnership Model](https://www.craftsmensoftware.com/how-we-work)  
[Career](https://careers.craftsmensoftware.com/)

[FAQ](https://www.craftsmensoftware.com/frequently-asked-questions-faq)  
[Privacy Policy](https://www.craftsmensoftware.com/privacy-policy-best-software-development-company-in-bangladesh) 

[Craftsmen LinkedIn Page](https://linkedin.com/company/craftsmensoftware)   [Craftsmen Facebook Page](https://www.facebook.com/craftsmenltd/)   [Craftsmen Youtube Page](https://www.youtube.com/@craftsmensoftware)

### **Headquarter**

**Craftsmen UK**  
One Sovereign Quay, Bridge End, Leeds, West Yorkshire LS1 4AG United Kingdom 

**Operational Hub

Craftsmen Bangladesh**  
Plot # 316, Lane # 4, DOHS Baridhara,

Dhaka - 1206, Bangladesh

### **Sales & Partnership Offices**

**Craftsmen Norway**  
Kong Oscars gate 66, 68, 5017 Bergen, Norway

**Craftsmen France**  
6 Avenue Pierre Grenier, 92100 Boulogne-Billancourt, Paris, France

### **A Team You Can Trust**

#### [![ISO Certificates New](https://www.craftsmensoftware.com/hs-fs/hubfs/ISO%20Certificates%20New.png?width=300&height=96&name=ISO%20Certificates%20New.png)](https://www.craftsmensoftware.com/trust-centre)

[![glassdoor (1)](https://www.craftsmensoftware.com/hs-fs/hubfs/glassdoor%20(1).png?width=110&height=79&name=glassdoor%20(1).png)](https://www.glassdoor.com/Overview/Working-at-Craftsmen-EI_IE3004266.11,20.htm) [![goodfirms.co](https://www.craftsmensoftware.com/hs-fs/hubfs/goodfirms.co.webp?width=110&height=95&name=goodfirms.co.webp)](https://www.craftsmensoftware.com/blog/craftsmen-thrives-at-goodfirms-by-offering-scalable-robust-software-solutions-developed-with-quality-by-maestros)

 

 © 2026 Craftsmen. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Saimon hossain",
    "url" : "https://www.craftsmensoftware.com/blog/author/saimon-hossain"
  },
  "dateModified" : "2026-04-30T10:53:34.581Z",
  "datePublished" : "2023-09-17T18:45:00.000Z",
  "headline" : "Build a CLI application with Python and Typer - Best Software Development Team Extension Partner for Nordics",
  "image" : [ "https://www.craftsmensoftware.com/hubfs/Build%20a%20CLI%20pipeline.webp" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.craftsmensoftware.com/blog/build-a-cli-application-with-python-and-typer",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.craftsmensoftware.com/hubfs/Craftsmen%20Logo_Black.png"
    },
    "name" : "Craftsmen Ltd."
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "SoftwareCompany",
  "address" : [ {
    "@type" : "PostalAddress",
    "addressCountry" : "Norway",
    "addressLocality" : "Oslo"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United Kingdom",
    "addressLocality" : "London"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "France",
    "addressLocality" : "Paris"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "New York"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "Bangladesh",
    "addressLocality" : "Dhaka"
  } ],
  "areaServed" : [ {
    "@type" : "Country",
    "name" : "Norway"
  }, {
    "@type" : "Country",
    "name" : "Sweden"
  }, {
    "@type" : "Country",
    "name" : "United Kingdom"
  }, {
    "@type" : "Country",
    "name" : "France"
  }, {
    "@type" : "Country",
    "name" : "United States"
  }, {
    "@type" : "Country",
    "name" : "Bangladesh"
  } ],
  "description" : "Trusted AI-native engineering partner providing software team extension, IT staff augmentation, and dedicated developer teams globally.",
  "logo" : "https://www.craftsmensoftware.com/hubfs/logo.png",
  "name" : "Craftsmen Software",
  "url" : "https://www.craftsmensoftware.com"
}
```