]> git.madduck.net Git - code/qantas-login.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

initial checkin master
authormartin f. krafft <madduck@madduck.net>
Sat, 18 Jan 2020 03:46:38 +0000 (13:46 +1000)
committermartin f. krafft <madduck@madduck.net>
Sat, 18 Jan 2020 03:46:38 +0000 (13:46 +1000)
qantas-login [new file with mode: 0755]

diff --git a/qantas-login b/qantas-login
new file mode 100755 (executable)
index 0000000..6763653
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+# © 2020 martin f. krafft <madduck@madduck.net>
+# 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…