#!/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…