Monday, September 12, 2016

How to search for and list available ppas via the python launchpad API?



I can't figure out how to use the python launchpadlib to search for ppas.



In other words, I am looking for a python API interface for the official launchpad (ubuntu) ppa search. A web form for the serach is offered here.




I would like to not only search for certain key words but also obtain a complete list of all ppas available on launchpad.



Could someone give me a hint to find the corresponding APIs?



Finding all PPAs



There is no API to do this and there probably won't be as you are not supposed to ask for huge collections of objects via the Python APIs.



Finding all PPAs with a certain name




AFAIK it is not possible. Report a feature request on https://bugs.launchpad.net/launchpadlib.



Finding all PPAs owned by a user with a given name



This is possible, use launchpad.people['username'].ppas, full example:



python
>>> from launchpadlib.launchpad import Launchpad
>>> launchpad = Launchpad.login_anonymously('just testing', 'production', '/home/user/tmp')

>>> [ ppa.name for ppa in launchpad.people['mvo'].ppas ]
[u'apt-clone-lucid', u'apt-fix-633967', u'apt-ftparchive-arch', u'apt-ftparchive-lucid', u'apt-ftparchive-srccache-backport', u'apt-gcc5', u'apt-https-fix', u'apt-lucid-chris', u'apt-precise', u'apt-src-ftparchive', u'apt-vivid', u'auto-upgrade-tester', u'debsigs-trusty', u'eglibc-trusty', u'freeglut-multiarch', u'gir-multiarch', u'hwe-eol', u'linux-firmware-nonfree', u'lp1347721', u'lp1371058', u'lucid-precise-upgrades', u'lucid-precise-upgrades2', u'oem', u'openoffice', u'ppa', u'public-test', u'python-apt', u'release-upgrader-apt', u'samba4', u'sdk', u'smem', u'synaptic', u'test-dependencies', u'ubuntu-sdk-libs', u'unattended-upgrades', u'upgrade-tests', u'wine', u'wsmancli']


You might think that you can combine this with searching people, but it will not work. There is a limit on how many people you can get (I think it is 50 or something like that).



The entire API is documented here: https://launchpad.net/+apidoc/1.0.html


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...