← Back to team overview

launchpad-users team mailing list archive

Re: looming LP query scripts

 

On Sat, Nov 2, 2013 at 2:52 PM, Tim Michelsen
<timmichelsen@xxxxxxxxxxxxxx> wrote:
> Hello,
> I am looking into preparartion of python scripts which could help me to
> retrieve information at LP.
> Specifically I would like to:
>
> * create a list with all packages in a certain PPA long with their
> version number
>
> * create a list of all repositories in a certain project.
>
> Is there such functionality in Launchpad?
>
> Where can I look for explanations on such API scripts?

The entry point for the API docs is here: https://help.launchpad.net/API

To get you started, the following example should work for your first use case:

----

#!/usr/bin/python

from launchpadlib.launchpad import Launchpad

PPAOWNER = 'andrewsomething'
PPANAME = 'typecatcher'

lp_login = Launchpad.login_anonymously('ppastats',
                                       'edge',
                                       '~/.launchpadlib/cache/',
                                       version='devel')
owner = lp_login.people[PPAOWNER]
archive = owner.getPPAByName(name=PPANAME)

for p in archive.getPublishedSources(status='Published'):
    print p.source_package_name, p.source_package_version

----

-- Andrew Starr-Bochicchio

   Ubuntu Developer <https://launchpad.net/~andrewsomething>
   Debian Developer <http://qa.debian.org/developer.php?login=asb>
   PGP/GPG Key ID: D53FDCB1


Follow ups

References