Attempting to authorize from cron script leads to repeated reauth attempts

Bug #1045774 reported by Brad Crittenden on 2012-09-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Scenario: A cron script want to log in via a pre-existing credentials file that is passed to the login_with() method as the 'credentials_file' parameter. If by mistake that file does not exist, then the call to login_with will attempt to interactively get authorization via the web browser dance.

In launchpadlib/ the AuthorizeRequestTokenWithBrowser.make_end_authorize_token method is eventually called. It contains this loop:

        while credentials.access_token is None:
            except HTTPError, e:
                if e.response.status == 403:
                    # The user decided not to authorize this
                    # application.
                    raise EndUserDeclinedAuthorization(e.content)
                elif e.response.status == 401:
                    # The user has not made a decision yet.
                    # There was an error accessing the server.
                    print "Unexpected response from Launchpad:"
                    print e

The sleep period is 1 second. The loop never gives up. Eventually mthaddon hunts you down and wakes you up at 5 a.m. on a national holiday to ask that you kill your script that is hammering Launchpad.

Related branches

Brad Crittenden (bac) on 2012-09-04
Changed in launchpadlib:
status: New → Triaged
Changed in launchpadlib:
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers