Print session information only if s dict is populated. - anticapum - Handle Università Politecnica delle Marche captive portal (HTM) hg clone https://bitbucket.org/iamleot/anticapum (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) changeset 798881bf3e28f00f342d73b997f7b527bdb27454 (DIR) parent 5d147f151a7608a3b0cbd7041168524f5babc3f8 (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Mon, 19 Mar 2018 11:38:29 Print session information only if s dict is populated. (Similarly to sigint_handler().) Diffstat: anticapum.py | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) --- diff -r 5d147f151a76 -r 798881bf3e28 anticapum.py --- a/anticapum.py Mon Mar 19 11:37:23 2018 +0100 +++ b/anticapum.py Mon Mar 19 11:38:29 2018 +0100 @@ -141,11 +141,12 @@ s = {} def siginfo_handler(signum, frame): - print('username:', s.get('username', '')) - print('ip:', s.get('ip', '')) - print('timestamp:', s.get('timestamp', '')) - print('sid:', s.get('sid', '')) - print('pulsante:', s.get('pulsante', '')) + if s: + print('username:', s.get('username', '')) + print('ip:', s.get('ip', '')) + print('timestamp:', s.get('timestamp', '')) + print('sid:', s.get('sid', '')) + print('pulsante:', s.get('pulsante', '')) def sigint_handler(signum, frame): if s: