# Python program to test internet speed
import speedtest
st = speedtest.Speedtest()
option = int(input('''What speed do you want to test:
1) Download Speed
2) Upload Speed
3) Ping
Your Choice: '''))
if option == 1:
print(st.download())
elif option == 2:
print (st.upload())
elif option == 3:
servernames = []
st.get_servers(servernames)
print (st.results.ping)
else:
print("Please enter the correct choice !")
Block any website using Python :
import time
from datetime import datetime as dt
hosts_path = "/etc/hosts"
redirect="127.0.0.1"
website_list =
["www.facebook.com", "facebook.com",
"dub119.mail.live.com", "www.dub119.mail.live.com",
"www.gmail.com", "gmail.com"]
while True:
if dt(dt.now().year, dt.now().month, dt.now().day, 8)
<dt.now() < dt(dt.now().year, dt.now().month,
dt.now().day, 16):
print("Working hours...")
with open(hosts_path, 'r+') as file:
content=file.read()
for website in website_list:
if website in content:
pass
else:
file.write(redirect website + "\n")
else:
with open(hosts_path, 'r+') as file:
content=file.readlines()
file.seek (0)
for line in content:
if not any(website in line for website in
website_list):
file.write(line)
file.truncate()
print("Fun hours...")
time.sleep (5)
Get IP address of your system using Python :
# Python Program to Get IP Address
import socket
hostname = socket.gethostname()
IPAddr = socket.gethostbyname (hostname)
print("Your Computer Name is:" + hostname)
print("Your Computer IP Address is:" + IPAddr)
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)