From: martin f. krafft Date: Sat, 18 Jan 2020 03:46:38 +0000 (+1000) Subject: initial checkin X-Git-Url: https://git.madduck.net/code/qantas-login.git/commitdiff_plain initial checkin --- 5f7b106265a512ae4660a95bfda161c84e88d161 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…