Anonymous Access to the Launchpad Web Service API
You asked for it and we’ve delivered. Your launchpadlib scripts can now get read-only access to the Launchpad web service API without going through any authorization process. Previously, to authorize your script, you had to open a web page in the end-user’s web browser and get the user to click a button. Now, you only have to go through that process if you want to access someone’s private data or modify the Launchpad dataset on their behalf.
If you’re using the latest version of launchpadlib (1.5.4), you can log in anonymously with the login_anonymously
helper method. You just have to pass in a string identifying your client, and the name of the Launchpad server you want to access.
from launchpadlib.launchpad import Launchpad launchpad = Launchpad.login_anonymously("my client", "edge") print launchpad.bugs[1].title # Microsoft has a majority market share'
(That code also illustrates how the latest version of Launchpadlib lets you specify a short string like “edge” instead of having to importing a constant like EDGE_SERVICE_ROOT.)
If you’re using an older version of launchpadlib, you can log in anonymously using the login
helper method. You can get anonymous access by passing in empty strings for the token string and access secret:
from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT launchpad = Launchpad.login("my client", "", "", EDGE_SERVICE_ROOT) print launchpad.bugs[1].title # Microsoft has a majority market share'
Right now, anonymous access only works on Launchpad’s ‘edge’ and ‘staging’ instances. It’ll be installed on production at the end of the month, with the release of Launchpad 10.01.
Tags: API