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 :: how to make a column a factor in pandas 
Python :: python how to delete from dictionary a nan key 
Python :: how to use get-pip.py 
Python :: geopandas change columns dtype 
Python :: install python in docker file 
Python :: python datetime object 
Python :: pathlib remove extension 
Python :: validity of password in python 
Python :: scikit learn pca 
Python :: django pandas queryset 
Python :: python re compile 
Python :: how to get confusion matrix in python 
Python :: matplotlib show plot 
Python :: how do i limit decimals to only two decimals in python 
Python :: word guessing game python 
Python :: print type error python 
Python :: sort dictionary by value and then key python 
Python :: pandas unique values to list 
Python :: legend font size python matplotlib 
Python :: pytube 
Python :: install a lower version of python using conda 
Python :: np.zeros 
Python :: Django custome login 
Python :: python declare a variable 
Python :: python check if dataframe series contains string 
Python :: dataframe in python 
Python :: python tkinter arabic 
Python :: read file csv in python 
Python :: selenium webdriver scroll down python 
Python :: ImportError: DLL load failed while importing win32file: The specified module could not be found. 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =