I'm only a beginner at this authentication business having only just managed to write my first server side code for handling basic and local auth, handling cookies, csrf tokens and so on.
But it seems to be that if you are faced with a login page prior to getting any internet access then there must be some form collecting usernames and passwords and then passing those to the server in a POST request on submit. Ergo it's possible to do all that programatically from a headless client.
I have no idea how this works in Python but in node.js it is very simple to create HTTP client code that can generate all manner of requests, read and write any headers, take care of cookies etc etc etc For example like this https://github.com/request/request
So this is now an exercise in finding out what that login page looks like when it gets to a client and what POST request is required in response. Taking care of cookies and csrf tokens etc if need be. I's start by with "view source". You might need to do some packet sniffing of a log in with wireshark or whatever. Of course if the thing uses HTTPS that's a bit of a problem.
If this ever worked I might be worried about keeping credentials on a machine that is out in the open. Does this thing have it's own account?
On the other hand, perhaps it's time to install a 3G dongle into the weather station, or some other means of by passing the school network.
One way we have tackled this in the past is to get the administrators to open a VPN port for our embedded systems that are inside their network. We used OpenSwan. Then our units had no connectivity to the internal network but could get out to the internet via the VPN. That does of course require you have some server on the net running the other end of the VPN connection, but hey a google cloud instance is very cheap.
Memory in C++ is a leaky abstraction .