Define new URL strings (to better mimic web browser behaviour) - 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 c55133a094f765a308ffb8c1a2f8480effa09f83
(DIR) parent 5112aedd77a65e3e77c590ba09a894ccc92adfbe
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Thu, 11 Jan 2018 21:24:58
Define new URL strings (to better mimic web browser behaviour)
Rename existing ANTICAPUM_URI to ANTICAPUM_URL_LOGIN, and also add
ANTICAPUM_URL_BASE, ANTICAPUM_URL_RENEW and ANTICAPUM_URL_LOGOUT.
The last two will be used to properly renew the connection and to gracefully do
a logout.
Diffstat:
anticapum.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff -r 5112aedd77a6 -r c55133a094f7 anticapum.py
--- a/anticapum.py Mon Jan 01 01:20:06 2018 +0100
+++ b/anticapum.py Thu Jan 11 21:24:58 2018 +0100
@@ -34,7 +34,10 @@
from urllib import parse, request
-ANTICAPUM_URI = 'https://captive.dii.univpm.it/login.php'
+ANTICAPUM_URL_BASE = 'https://captive.dii.univpm.it/'
+ANTICAPUM_URL_LOGIN = ANTICAPUM_URL_BASE + 'login.php'
+ANTICAPUM_URL_RENEW = ANTICAPUM_URL_BASE + 'renew.php'
+ANTICAPUM_URL_LOGOUT = ANTICAPUM_URL_BASE + 'logout.php'
ANTICAPUM_NETRC_MACHINE = 'captive.univpm.it'
ANTICAPUM_SLEEP = 310
@@ -61,7 +64,7 @@
# TODO: Find a way to verify the cert!
sc = ssl.SSLContext()
sc.verify_mode = ssl.CERT_NONE
- with request.urlopen(ANTICAPUM_URI, data=auth, context=sc) as f:
+ with request.urlopen(ANTICAPUM_URL_LOGIN, data=auth, context=sc) as f:
pass