Introduction to Dynamic CLI in Python
Last Updated :
12 Jul, 2022
In this article, we will see an introduction to Dynamic CLI in Python.
What is Dynamic CLI?
A Modern, user-friendly command-line HTTP client for API testing, It helps a programmer to code more efficiently by increasing one’s productivity and by reducing the time and effort required to perform tasks of searching for solutions and making API requests. So without wasting any further time let’s get right into it. Also using postman and other software for API testing are good but can be difficult for a beginner, dynamic-cli also provides the functionality of API testing where you can simply make API requests from your terminal.
Installation Using PIP
Use the following command
pip3 install dynamic-cli
Installation Using Virtual Environment
You can use this method to avoid possible issues with dependencies or permissions. This is recommended method
Install virtualenv
pip3 install virtualenv
Create a dynamic-cli virtualenv and install dynamic-cli:
mkvirtualenv dynamic-cli
pip3 install dynamic-cli
If you want to activate the dynamic-cli virtualenv again later, run:
workon dynamic-cli
To deactivate the dynamic-cli virtualenv, run:
deactivate
Searching For Error
Now that dynamic CLI is installed correctly we can move forward and use it. Dynamic CLI offers different command-line arguments for different tasks such as for searching for something we use the command:
dynamic -s
Step 1. After pressing enter you will be asked to enter an error/question to search

Enter Question
Step 2. After that you will be asked to enter tags for a better search this is optional.

Optional Tags
Step 3. Now there will be multiple results to questions you can toggle between each one and get the answer.

Results
Step 4. If you want to open that question in the browser you can press ‘enter’.

Opened Browser
Step 5. If you wanna save questions to the playbook for later access you can press ‘p’.

Question saved in playbook
Step 6. If you want to quit you can press ‘ESC’ or ‘q’.
Accessing Playbook
You started using dynamic CLI found multiple answers and saved them in the playbook but if you want to retrieve them later to do this you need to access a playbook that is stored in your local storage. To do that you can use the following command.
dynamic -p
This will show all the questions stored in the playbook

Playbook
API Testing
Moving on to the next use of dynamic cli you can also send requests to an API and receive responses. There are three HTTP methods you can use as of now which are:
Let’s see how to use them one by one, for this tutorial I am going to use reqres.in which is a platform to make sample AJAX requests.
Also once you successfully get a response you can store in your local drive.
GET Method
To perform the GET HTTP method enter the following command to your terminal
dynamic -GET
After you press enter on your terminal it will ask you to enter the URL to make the request after that you will need to enter headers if your request needs headers you can add them then it will get the response and present to you in JSON format after that you will be asked if you want to save results if you press ‘Y’ then enter the file name you want to store your results in and press enter.

GET Method
POST Method
To perform the POST HTTP method enter the following command to your terminal
dynamic -POST
In the POST method we send the payload(data) there are two ways using which you can send data in dynamic-cli. First, you will be asked to enter the URL then you can add headers then you will be asked if you want to send payload data or not if you press ‘Y’ you will be prompted with two choices which are
Sending Payload from terminal
If you choose first then you can send data from the terminal you need to specify data in key:value format just like we specify in the curl request.
After that, you can save the response.
Sending Payload from JSON file
If you choose option two you can send data from the JSON input file. You need to specify the name of the file and you will get the JSON response which you can save.

POST Method
DELETE Method
To perform the DELETE HTTP method enter the following command to your terminal
dynamic -DELETE
Same as other HTTP methods first you will be asked to enter the URL after that headers if the deletion operation is successful you will have the response with HTTP code 204 which represents no content.

DELETE Method
Similar Reads
Introduction to Python3
Python is a high-level general-purpose programming language. Python programs generally are smaller than other programming languages like Java. Programmers have to type relatively less and indentation requirements of the language make them readable all the time. Note: For more information, refer to P
3 min read
Python Introduction
Python is a widely used high-level, interpreted programming language. It was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. It was designed with an emphasis on code readability, and its syntax allows programmers to express their concepts in fewer lines o
5 min read
Introduction to Python for Absolute Beginners
Are you a beginner planning to start your career in the competitive world of Programming? Looking resources for Python as an Absolute Beginner? You are at the perfect place. This Python for Beginners page revolves around Step by Step tutorial for learning Python Programming language from very basics
6 min read
Jython - Introduction and Installation
It's not hidden that Java is a powerful and Python is a simple and easy language. To get them both together, Jython was introduced so it is both powerful and simple. It is a pure Java implementation of Python. It uses Python's syntax and Java's environment. It allows using features of Python in Java
2 min read
How to Dynamically Load Modules or Classes in Python
Python provides a feature to create and store classes and methods and store them for further use. The file containing these sets of methods and classes is called a module. A module can have other modules inside it. Note: For more information, refer to Python Modules Example: A simple example of impo
3 min read
Interact with files in Python
Python too supports file handling and allows users to handle files i.e., to read, write, create, delete and move files, along with many other file handling options, to operate on files. The concept of file handling has stretched over various other languages, but the implementation is either complica
6 min read
How to call a function in Python
Python is an object-oriented language and it uses functions to reduce the repetition of the code. In this article, we will get to know what are parts, How to Create processes, and how to call them. In Python, there is a reserved keyword "def" which we use to define a function in Python, and after "d
5 min read
Defining a Python function at runtime
One amazing feature of Python is that it lets us create functions while our program is running, instead of just defining them beforehand. This makes our code more flexible and easier to manage. Itâs especially useful for things like metaprogramming, event-driven systems and running code dynamically
3 min read
Introduction to JustPy | A Web Framework based on Python
JustPy is a web framework that leverages the power of Python to create web applications effortlessly. In this article, we'll explore JustPy, its features, and why it's gaining attention among developers. What is the JustPy Module of Python?The JustPy module of Python is a web framework like Django b
8 min read
Python Projects - Beginner to Advanced
Python is one of the most popular programming languages due to its simplicity, versatility, and supportive community. Whether youâre a beginner eager to learn the basics or an experienced programmer looking to challenge your skills, there are countless Python projects to help you grow. Hereâs a list
10 min read