{"id":8267,"library":"launchpadlib","title":"launchpadlib","description":"launchpadlib is an officially supported Python library for scripting Launchpad.net through its web services interfaces. It allows interaction with Launchpad objects like bugs, blueprints, and packages. The current version is 2.1.0, and it generally follows an as-needed release cadence for bug fixes and Python compatibility updates.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/launchpadlib/launchpadlib","tags":["launchpad","api","web services","canonical","ubuntu","bug tracking"],"install":[{"cmd":"pip install launchpadlib","lang":"bash","label":"Install launchpadlib"}],"dependencies":[{"reason":"Provides the RESTful client base for interacting with Launchpad's API.","package":"lazr.restfulclient"},{"reason":"Used for HTTP communication. Can sometimes cause SSL/TLS issues with older versions or configurations.","package":"httplib2","optional":false},{"reason":"Provides Unix domain socket support for requests.","package":"requests-unixsocket","optional":false},{"reason":"Used for parsing subunit streams, often in testing contexts.","package":"python-subunit","optional":false}],"imports":[{"symbol":"Launchpad","correct":"from launchpadlib.launchpad import Launchpad"}],"quickstart":{"code":"import os\nfrom launchpadlib.launchpad import Launchpad\n\n# Anonymous access (read-only for most public data)\n# Use a unique application name, e.g., 'my-app-name-dev'\nlaunchpad_anon = Launchpad.login_anonymously('my-checklist-day-app', 'production')\nprint(f\"Logged in anonymously as {launchpad_anon.me}\")\n\n# Authenticated access (for writing data, private access)\n# This will prompt for credentials if not already cached.\n# Launchpad credentials are often stored in ~/.launchpadlib/creds\n\n# To avoid interactive prompts in automated scripts, ensure credentials\n# are pre-configured or use a 'testing' or 'staging' service root.\n# For example, to avoid prompting, you could use:\n# launchpad_auth = Launchpad.login_with_creds(\n#    'my-checklist-day-app-auth',\n#    'production', \n#    credentials_file='~/.launchpadlib/creds_my_app'\n# )\n\ntry:\n    # This may prompt for credentials interactively if not cached\n    launchpad_auth = Launchpad.login_with_creds('my-checklist-day-app-auth', 'production')\n    print(f\"Logged in as {launchpad_auth.me}\")\n    # Example: Access your personal information\n    # print(f\"My email address: {launchpad_auth.me.preferred_email_address}\")\nexcept Exception as e:\n    print(f\"Could not log in with credentials: {e}\")\n    print(\"To enable authenticated access, run this script interactively once to cache credentials.\")\n\n# Example of using the anonymous connection to get a person:\nperson = launchpad_anon.people['canonical']\nprint(f\"Canonical's display name: {person.display_name}\")","lang":"python","description":"This quickstart demonstrates both anonymous and authenticated access to the Launchpad API. Anonymous access is suitable for reading public data. Authenticated access (via `login_with_creds`) allows for private data access and write operations, often requiring interactive credential setup or pre-existing credential files for automated scripts. Remember to use a unique application name."},"warnings":[{"fix":"Upgrade to Python 3.8+ and install launchpadlib 2.x. If you have legacy Python 2 code, it will require porting.","message":"launchpadlib 2.0.0+ requires Python 3.8 and is incompatible with Python 2.x. Older versions (pre-2.0.0) were Python 2 only.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Ensure your system's CA certificates are up-to-date. In some cases, configuring `HTTP_PROXY` or `HTTPS_PROXY` environmental variables incorrectly can also lead to issues. If strictly necessary and aware of security implications, you might temporarily disable verification (e.g., `httplib2.Http(disable_ssl_certificate_validation=True)`), but this is not recommended for production.","message":"SSL/TLS Certificate Verification Errors due to `httplib2` dependency.","severity":"gotcha","affected_versions":"All versions using `httplib2` (including 2.x)"},{"fix":"For automated scripts, ensure credentials are pre-cached by running the script once interactively, or explicitly provide a `credentials_file` argument to `login_with_creds` pointing to a file with pre-obtained credentials (e.g., `~/.launchpadlib/creds`). Ensure your application name is consistent.","message":"Authentication issues with `login_with_creds` in non-interactive environments.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement exponential backoff and retry logic for your API calls. Design your scripts to make efficient use of the API, fetching data in batches where possible rather than individual items.","message":"Launchpad API Rate Limiting can cause requests to fail with HTTP 429 Too Many Requests.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure launchpadlib is installed in your active Python environment: `pip install launchpadlib`.","cause":"launchpadlib is not installed, or you are running in a different Python environment than where it was installed.","error":"ImportError: No module named 'launchpadlib.launchpad'"},{"fix":"Use `Launchpad.login_with_creds()` and ensure you have valid, cached credentials. If running interactively, it should prompt you. For scripts, verify `~/.launchpadlib/creds` exists and is valid, or explicitly provide a `credentials_file`.","cause":"Attempted to access private data or perform an action requiring authentication without valid credentials, or the provided credentials are incorrect/expired.","error":"launchpadlib.errors.HTTPError: [401] Unauthorized"},{"fix":"Update your operating system's CA certificates. If behind a corporate proxy, consult your IT department for proper proxy configuration (e.g., `HTTP_PROXY`, `HTTPS_PROXY` env vars) or necessary custom certificate installations.","cause":"The underlying `httplib2` library is failing to verify the SSL certificate of Launchpad.net. This can be due to outdated system CA certificates or network configurations (e.g., corporate proxies intercepting SSL).","error":"ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:XXXX)"},{"fix":"Double-check the identifier or URL you are using. For example, ensure the person's Launchpad ID or project name is spelled correctly.","cause":"The requested Launchpad object (e.g., a person, bug, project) does not exist or its URL is incorrect.","error":"launchpadlib.errors.HTTPError: [404] Not Found"}]}