Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Automate login
-
I was trying to use the mechanize library to automate a login to a Wifi Access point authentication page. The problem is that when this page appears in the Browser the iPad is not yet logged into the network so mechanize's br.open("url") reports (correctly) that there is no network connection. Is there any way to use Pythonista to fill out and submit the authentication data?
-
Are you talking about the redirected page that some wifi spots take you to (where you must read the agreement, maybe login, etc) as opposed to the ios authentication?
For the latter, I think you may be out of luck. For the former, since the login is via a redirect, you should be able to do it, however I'm not sure if mechanize follows redirects... requests might?
-
@JonB Yes, it is a redirect and I am using the URL of the page but the problem seems to be that the iPad reports to Mechanize that there is no network connection. It works fine if I go to the page after the connection is made manually. Of course that is not helpful since the whole point is to eliminate the manual login. I can try requests.
-
I may have spoke too quickly. The browser page requiring login credentials comes up as soon as one selects the access point, it is not necessary to first open the browser. Does that change the approach required to automate?
-
I have not tried to automate one of those. Sometimes, I think, if you close that dialog, then try to open a non https page, like, say example.com, you will get the auth page again. But, I feel like I have also seen cases where that didn't happen. If you can open the browser and get to it, I don't see any reason you wouldn't be able to automate it.
-
The br.open("url") results in "URLError: urlopen error [Errno 51] Network is unreachable"
I think this is a Catch 22..you need to be on a network to get on the network. -
Did you try with
requests
?import requests URL = 'https://192.168.1.1' print(requests.get(URL).content)
-
I tried requests and the problem persists. This time the error is "socket error" (errno 51). I am trying to fill-in a page which pops up when the access point is selected but the iPad must tell the Apps that there is no connection so I don't think there is a way to do this.