-
Notifications
You must be signed in to change notification settings - Fork 0
/
Messenger.py
44 lines (38 loc) · 1.13 KB
/
Messenger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import json
from tkinter import *
from tkinter.messagebox import showinfo, showerror
def send_sms(number, message):
url = 'https://www.fast2sms.com/dev/bulk'
params = {
'authorization': '0pGlVmOkuXtQMhfiw9U8bdEegBFSoJjvxArNWTn13RyHZD4qKCvmisY9JwdIF1OV7Eq8zTZy3kurxG0f',
'sender_id': 'FSTSMS',
'message': message,
'language': 'english',
'route': 'p',
'numbers': number
}
response = requests.get(url, params=params)
dic = response.json()
print(dic)
return dic.get('return')
def btn_click():
num = textNumber.get()
msg = textMsg.get("1.0", END)
r = send_sms(num, msg)
if r:
showinfo("Send Success", "Successfully sent")
else:
showerror("Error", "Something went wrong..")
# Creating GUI
root = Tk()
root.title("Message Sender ")
root.geometry("400x550")
font = ("Helvetica", 22, "bold")
textNumber = Entry(root, font=font)
textNumber.pack(fill=X, pady=20)
textMsg = Text(root)
textMsg.pack(fill=X)
sendBtn = Button(root, text="SEND SMS", command=btn_click)
sendBtn.pack()
root.mainloop()