Accessing Launchpad remotely

Brad Bollenbach brad.bollenbach at pobox.com
Wed Jul 5 17:13:38 BST 2006


On Tue, 2006-04-07 at 21:45 +0200, Lionel Dricot wrote:
> Hello,
> 
> I'm doing an application to help bug triagers on malone. I tought that
> there was an xml-rpc interface on Launchpad but it seems that I was
> wrong. So I need some advices.

I can't promise that there will be any changes made to Malone to serve
your needs specifically. The issues you raise are almost certainly
valid, but the current priorities of the Launchpad project won't
necessarily address those in the short term.

So I'll offer you workarounds that you can consider right now that will
hopefully work even if no changes are made to the app to help your
current use cases.

> 1) Reading a bug
> 
> I tried with the simple text interface : https://launchpad.net/bugs/1/+text
> But I don't have the content of the bug nor the comments.
> (this is https://launchpad.net/products/launchpad/+bug/51835)
> Bradb told that the content might be available in +edit mode.
> 
> But what are those +xxx mode and how can I find them ? (any documentation ?)
> Do you have any advice on what I can use ?

I was referring to the page you get when you click "Edit Description",
e.g.

  https://launchpad.net/products/launchpad/+bug/51835/+edit

On this page, the description is easy to extract, because it's in a
widget.

> 2) Performing a search and get (number, package, title, severity,
> importance) of the results
> 
> I also tried the text interface like
> https://launchpad.net/distros/ubuntu/+bugs-text?field.searchtext=anything+you+want
> Unfortunatly, in +bugs-text mode, parameter are just ignored.
> Also, I only have the number of the bug so I have to retrieve each bug
> to display the results !!!
> I can maybe work around this by only doing ten bugs at a time but it
> will not be friendly for the user. Any advice for this ?

The return value of +bugs-text doesn't seem in our best interest. We may
need to reconsider how to present information more like +bugs, while
still making it easy to parse, perhaps something that smells like
rfc822.

The search params being apparently ignored appears to be a bug.

> 3) Modify an existing bug with a given account.
> 
> No idea on how I can do that besides screen-scraping

The two current options are email and web.

> 4) posting a new bug
> 
> I know that you can post bugs with email but I don't like very much
> this solution because you need a working SMTP. Any advice on a way to
> post a bug from a given user ?

The only other option currently is web, though the xmlrpc API for
reporting a bug is perhaps a month away from production deployment,
possibly much shorter.

> 5) creating an user
> 
> In the middle-term, I want my user to be able to create a launchpad
> account if he has none yet. Any ideas on this ?

I don't imagine this will be any easier to do before the end of the
Summer of Code. It's probably premature for me to make predictions
beyond that horizon. 

> If there's not other solution, I can parse the html and send forms
> with beautifulsoup or mechanize. As anyone experiences with those
> library ? Wich is better ?

They fulfil different needs. BeautifulSoup is something you might want
to use to more easily extract data from a page, and mechanize simulates
web browsing in Python. Each seem to do their respective tasks
reasonably well.

Even better, though perhaps a little harder to get installed (since I
don't think there's an official packaging of it) is zope.testbrowser.
Here's an example of how sweet it can be if you do take the time to set
it up:

>>> from zope.testbrowser.browser import Browser
>>> browser = Browser()
>>> browser.open("https://launchpad.net/+login")
>>> browser.getControl("E-mail address").value = "you at example.com"
>>> browser.getControl("Password").value = "password"
>>> browser.getControl("Log In").click()
>>> browser.open("https://launchpad.net/products/launchpad/+bug/51835/+edit")
>>> browser.getControl("Description").value
"If you retrieve informations of a bug in +text mode, you will miss the content of the bug.\r\n\r\nSee https://launchpad.net/bugs/1/+text\r\n\r\nThere's no content at all !"

Talk to BjornT in #launchpad if you want to know more about where to get it.

HTH,

Brad




More information about the launchpad-users mailing list