I would like to retrieve programatically all questions&answers related to one project from launchpad, so that I can import those to a new forum site. I was looking at launchpadlib but I cannot access questions for a single project:
from launchpadlib.launchpad import Launchpad
ll=Launchpad.login_anonymously('')
# get the project; but it does not contain references to questions (it references bugs, translations etc, but not questions
pro=ll.project['woo']
# some (random?) question from launchpad, but not for the project I need
ll.questions
using the web API would be also fine. Getting the content in any machine-readable format (JSON, XML) is th goal.
The default 1.0 API version is stable but quite old, and doesn't include many methods that have been exported more recently. For this you need to use the "devel" version of the API:
Then you can use methods documented in the devel API docs, specifically
project.searchQuestions
:You can limit this in various ways as the API docs indicate, or just ask for everything as above; either way, you'll get back a batched collection of question objects that you can iterate over and operate on.