Send OTP Using Python

Send OTP Using Python

In this tutorial are going to make a real-time GUI to Send OTP Using Python. For this project, we are going to use four modules namely Tkinter, Requests, Random, and JSON.

Tkinter will be used for creating the UI.

Requests will be used to send a GET request to the site.

JSON will be used for setting the parameters and the random module will be used for generating the OTP.

Also, you need to create an account on fast2sms. Creating an account is very simple. Go to and create an account for free. As a new user, you will receive a 50 rupees balance in your wallet.

Now Goto Dev API and generate your API. Copy your unique API and paste it into the JSON part of the code.

Complete Code to Send OTP Using Python

from tkinter import *
import tkinter.messagebox as tsmg
import requests
import random
import json



msg=f"Your One Time Password(OTP) is {rand}"

def sms_send(a,msg):
   // Paste Your Unique API Here in-place of ************

def send():
        tsmg.showerror("Error","Enter Your Mobile Number")
    elif (len(a)<10):
        tsmg.showerror("Error","Invalid Mobile Number")
        b=tsmg.askyesno("Info",f"Your Number is {a}")

def check():
        tsmg.showerror("Error","Enter OTP")
            tsmg.showerror("Error","Invalid OTP")



Label(f1,text="Check Your OTP",font="SegoeUI 30 bold",fg="purple").pack(padx=5,pady=10)

Label(f2,text="Enter Your Number",font="SegoeUI 20 bold",fg="teal").pack(padx=5,pady=5)
e1=Entry(f2,textvariable=num,font="SegoeUI 14 bold",fg="black",bg="white",relief=SUNKEN,borderwidth=4,justify="center").pack(ipady=5)

Label(f3,text="Enter OTP",font="SegoeUI 20 bold",fg="teal").pack(padx=5,pady=5)
e2=Entry(f3,textvariable=otp,font="SegoeUI 14 bold",fg="black",bg="white",relief=SUNKEN,borderwidth=5,justify="center").pack(ipady=5)

Button(f4,text="Send OTP",command=send,font="SegoeUI 10 bold",fg="purple").pack(padx=20,pady=10,side=LEFT)
Button(f4,text="Check OTP",command=check,font="SegoeUI 10 bold",fg="purple").pack(padx=40,pady=10,side=LEFT)



Send OTP Using Python
Send OTP Using Python

Hope You All Liked This Project.
Comment Down Your Views/QUERIES if you have.

Also Read:

  • Print Colored Text Output in Python
    Introduction Command line applications often return text in the same color as the terminal. There are times when we wish to draw the user’s attention to output, such as a warning or error message. In certain circumstances, a splash of color may make all the difference. This article demonstrates how to Print Colored Text Output…
  • Gender Recognition by Voice using Python
    In this article, we are going to build a project on Gender Recognition by Voice using Python in Machine Learning. This is an era of technology and everyone is using technology nowadays as it’s making our lives so easier. ML models are used in various sectors and also in real-time recognition as well. One of…
  • Make money with Python in 2022
    Hello friends, do you know there are many ways to can make money with Python? Yes, I am not joking, this is absolutely real, anyone even a beginner can money with Python or any other technology/programming language. We are not lying, today, we are going to tell you the top 10 real and 100% working…
  • Top 15 Python Libraries For Data Science in 2022
    Introduction In this informative article, we look at the most important Python Libraries For Data Science and explain how their distinct features may help you develop your data science knowledge. Python has a rich data science library environment. It’s almost impossible to cover everything in a single article. As a consequence, we’ve compiled a list…
  • Top 15 Python Libraries For Machine Learning in 2022
    Introduction  In today’s digital environment, artificial intelligence (AI) and machine learning (ML) are getting more and more popular. Because of their growing popularity, machine learning technologies and algorithms should be mastered by IT workers. Specifically, Python machine learning libraries are what we are investigating today. We give individuals a head start on the new year…
  • File Explorer in Python using Tkinter
    Introduction Welcome to In this tutorial, we are going to learn File Explorer in Python using the Tkinter module. What is basically a file explorer? A file explorer is nothing but an application that is used to manage certain files and folders on your device where we can open, edit, copy, delete and move…
  • Drawing Application in Python Tkinter
    Introduction In this article, we will design and construct a basic Drawing Application in Python Tkinter GUI, where we can simply draw something on the canvas using a pencil and erase with an eraser, as well as the ability to change the thickness of a pencil and eraser. We may also modify the canvas’s background…
  • Sequel Programming Languages(SQL)
    In this article, we are going to learn about Sequel Programming Languages(SQL). Big enterprises like Facebook, Instagram, and LinkedIn, use SQL for storing the data in the back-end. So, If you want to get a job in the field of data, then it is the most important query language to learn. Before getting started, let…
  • Run Python Code, Install Libraries, Create a Virtual Environment | VS Code
    Visual Studio Code is one of the most efficient code compilers/interpreters. It is very promising because of the vast and widely available go-to extensions that help programmers. This article is an elaborative detail about how we can run Python code, install Python libraries, and create a virtual environment in Visual Studio Code. Write and Run…
  • Top 32 Python Interview Questions For Experienced
    Introduction Being an expert in a programming language may guarantee you a good salary and a rewarding job. Among the hundreds of programming languages presently accessible, Python has moved to the top of the list of the most popular. Let’s start at the beginning with some general Python Interview Questions For Experienced. These are the…

Avatar of Dhruv Paghdal

Author: Dhruv Paghdal