Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ping with python

import subprocess

def main():
    host = input("Enter Host: ")
    packet = int(input("
Enter Packet: "))
    print("
")
    ping = subprocess.getoutput(f"ping -w {packet} {host}")
    print(ping)

main()
Comment

ping from python

from pythonping import ping

def ping_host(host):
    ping_result = ping(target=host, count=10, timeout=2)

    return {
        'host': host,
        'avg_latency': ping_result.rtt_avg_ms,
        'min_latency': ping_result.rtt_min_ms,
        'max_latency': ping_result.rtt_max_ms,
        'packet_loss': ping_result.packet_loss
    }

hosts = [
    '192.168.48.1',
    '192.168.48.135'
]

for host in hosts:
    print(ping_host(host))
Comment

how to get ping from computer IN PYTHON

st = Speedtest()
    print("Download:=>", st.download())
    print("upload:=>", st.upload())
    st.get_servers([])
    print("Ping :=>", st.results.ping)
Comment

PREVIOUS NEXT
Code Example
Python :: get input from user in python 
Python :: dataframe create 
Python :: rename columns 
Python :: intersect in python list 
Python :: python generate random string 
Python :: convert float in datetime python 
Python :: error command errored out with exit status 1 face_recognition 
Python :: csv writer python 
Python :: streamlit change tab name 
Python :: hstack in numpy 
Python :: make a script run itself again python 
Python :: python bitwise operators 
Python :: python try except 
Python :: iterate through characters in a string python 
Python :: remove hyperlink from text python 
Python :: beautiful soup documentation 
Python :: delete migrations django and start over deployment heroku 
Python :: python validate url 
Python :: select a random element from a list python 
Python :: how to create a matrix using python 
Python :: NumPy unique Example Get the counts of each unique value 
Python :: removing whitespaces from pandas dataframe csv 
Python :: redirect in dajango 
Python :: how to check how many items are in a list python 
Python :: python how to print input 
Python :: dataframein python 
Python :: python max key dictionary key getter 
Python :: sort eigenvalues and eigenvectors python 
Python :: split pandas row into multiple rows 
Python :: create array with unknown size in python 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =