In the sense of “my head against wall”, banging is the word which sums up most of today. I was working on a web development task that required me to login to a server and extract a “magic” key that allows me access to other resources on that machine. It sounds very simple but I wanted to empower one of my webservers to do that in the background so the the resources become available to users of my system without them having to worry about a futher set of login credentials.
I gave this an unsuccessful push a couple of weeks ago, when I got as far as realising that a login was needed. This morning, I was trying a Python port of PhantomJS. It sounded ideal – an interface in one of my favourite programming languages to allow headless access to a website (ie. without having to manually click through the pages) but I couldn’t figure out how to get it working. I’m sure I probably missed something elementary but there were too many variables (was it my older version of Ubuntu or the abandonware nature of pyPhantomJS or a quirk of the remote server).
In the afternoon, I tried logging into a webserver under my full control and still got nowhere. Eventually, I stepped back and picked a different wall!
It turns out that, with a little bit of experimenting, the trusty old commandline wget tool can be used to do what I need. I’ve got a bit of further tidying up to but I feel back on familiar ground; I can pass the credentials, get the chunk of text containing the key and extract it. Now it is time to step away from the pixel face… not least because I need to make sure it still works in the cold light of a new day!