Thanks Thanks:  0
Ergebnis 1 bis 1 von 1
  1. #1
    Avatar von Mr.Servo
    Registriert seit
    10.08.2020
    Ort
    Pfalz / Palatinate
    Beiträge
    2.656
    Thanks (gegeben)
    1811
    Thanks (bekommen)
    2434
    Total Downloaded
    56,91 MB
    Total Downloaded
    56,91 MB
    ReceiverDanke
    Box 1:
    GigaBlue UHD UE 4k Cable (openATV 7.4)
     
     
    Box 2:
    Mut@nt HD51 4k Cable (oATV DEVEL)
     
     

    Lightbulb ping.py für Python 2+3 / ping.py for Python 2+3

    ping.py für Python 2+3 als Standalone oder zum Einbinden in Plugins

    Hallo Zusammen,

    anbei stelle ich mal eine 'ping.py' zur Verfügung, die mit Enigma2 unter Python 2+3 lauffähig ist.

    Sie kann im TTY (z.B. mit PuTTY) alleine aufgerufen werden oder aber von Plugins importiert und verwendet werden. Dort hat diese den Vorteil, daß es möglich ist diese ohne jegliche Konsolentextausgabe (also ohne print) zu verwenden (quiet_ping) oder aber mit Konsolentextausgabe (verbose_ping). Als Rückmeldung gibt es dann auch ein schönes Tupel mit 'max/min/avg/packet_loss'

    ping.py for Python 2+3 as standalone or for implementation in plugins

    Hello everybody

    I have attached a 'ping.py' that runs with Enigma2 under Python 2 + 3.

    It can be called up alone in TTY (e.g. with PuTTY) or it can be imported and used by plugins. There this has the advantage that it is possible to use it without any console text output (i.e. without print) (quiet_ping) or with console text output (verbose_ping). There is also a nice tuple as feedback with 'max / min / avg / packet_loss'

    Hier mal der Aufruf im TTY / here the call in TTY:
    Code:
    python ping.py -h    (zeigt die Verwendung / Möglichkeiten) / (shows the use / possibilities) 
    
    python ping.py google.de   (mißt die Verbindung zu www.google.de mit Defaultparametern) / (measures the connection to www.google.de with default parameters)

    Hier mal der Aufruf aus einem Pythoncode heraus / Here is the call from a Python code:
    Code:
    from ping import quiet_ping  # alternatively: from ping import verbose_ping
    
    # DEFAULT-values
    # ---------------
    # timeout = 3000
    # count = 3
    # packet_size = 64
    # path_finder = False
    #
    # using program with all possible parameters:
    # result = quiet_ping("www.google.de", timeout, count, packet_size, path_finder)
    
    # using program with minimum parameters:
    result = quiet_ping("google.de") # using default values
    if result:
        if result[3] < 1:
            print ("Maximal %3.2f Milliseconds" % result[0])
            print ("Minimal %3.2f Milliseconds" % result[1])
            print ("Average %3.2f Milliseconds" % result[2])
            print ("Timeout packet loss: %2.1f%% " % (result[3]*100))
        else:
            print ("All attempts resulted in a timeout.")
    else:
        print ("URL not found.")
    
    Gruß......Mr.Servo
    Angehängte Dateien Angehängte Dateien
    Geändert von Mr.Servo (10.03.2021 um 19:07 Uhr) Grund: Code korrigiert

    •   Alt Advertising

       


Stichworte

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:50 Uhr.
Powered by vBulletin® Version 4.2.5 (Deutsch)
Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.
Resources saved on this page: MySQL 5,56%
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)
vBulletin Skin By: PurevB.com