[Tutor] Avoiding reauthentication to web services?
Steven D'Aprano
steve at pearwood.info
Thu Jul 21 21:58:44 CEST 2011
Ryan on the Beach wrote:
>
> Hello.
> I am trying to write a python program to control a lighting controller through it's rest interface. It requires ssl and basic authentication. I have been successful using urllib2. However, the authentication takes a very long time on the controller so multiple http gets are slow. I believe this is because of the controller itself.
> In a web browser after I authenticate each request is very fast, presumably because the browser is not re-authenticating again and again. In an attempt to fix this I tried httplib2 after some googling thinking it might give me the desired result, but it does not either.
> Can anyone suggest how this would be accomplished? I want to keep the connection "open". At least so it does not re-authenticate over and over again, similar to how it works within a web browser. Is this possible?
My guess is that it may use cookies to stay authenticated. See the
cookielib. What happens if you tell the browser to reject cookies?
--
Steven
More information about the Tutor
mailing list