From 5f7b106265a512ae4660a95bfda161c84e88d161 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 18 Jan 2020 13:46:38 +1000 Subject: [PATCH 1/1] initial checkin --- qantas-login | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 qantas-login diff --git a/qantas-login b/qantas-login new file mode 100755 index 0000000..6763653 --- /dev/null +++ b/qantas-login @@ -0,0 +1,26 @@ +#!/usr/bin/python3 +# © 2020 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# https://git.madduck.net/code/wifionice-login.git + +URL='http://qantas.com.au' + +import mechanicalsoup +import requests + +# open any URL +browser = mechanicalsoup.StatefulBrowser() +browser.open(URL) + +# get the captive page, and extract the URL that'll eventually grant us access +page = browser.get_current_page() +granturl = page.find(id='frequentflyerguestbutton').attrs['href'] + +# Qantas now expects a HEAD request with a specific header to the same URL +url = browser.get_url() +req = requests.head(url=url, headers={'X-Requested-With':'XMLHttpRequest'}) + +# and then a redirect to the granturl +browser.open(granturl) + +# and now you're logged in… -- 2.39.5