{"id":7523,"library":"pulp-glue","title":"Pulp Glue Library","description":"`pulp-glue` is a Python library that provides a version-agnostic interface for interacting with PulpCore's REST API. It aims to abstract differences between PulpCore API versions, offering a more stable API surface for consumers. The current version is 0.39.0, with regular updates typically tied to PulpCore releases.","status":"active","version":"0.39.0","language":"en","source_language":"en","source_url":"https://github.com/pulp/pulp-glue","tags":["pulp","pulpcore","api-client","rest-api","package-management"],"install":[{"cmd":"pip install pulp-glue","lang":"bash","label":"Install pulp-glue"}],"dependencies":[],"imports":[{"symbol":"PulpConnection","correct":"from pulp_glue.common.connection import PulpConnection"},{"symbol":"PulpAPI","correct":"from pulp_glue.common.api import PulpAPI"},{"note":"Deprecated to call `get_client()` directly on a `PulpAPI` object since 0.34.0.","wrong":"api_instance.get_client()","symbol":"get_client","correct":"from pulp_glue.pulpcore.client import get_client"}],"quickstart":{"code":"import os\nfrom pulp_glue.common.connection import PulpConnection\nfrom pulp_glue.common.api import PulpAPI\nimport httpx # For error handling\n\n# Configuration (replace with your Pulp server details or environment variables)\nPULP_BASE_URL = os.environ.get('PULP_BASE_URL', 'https://localhost:8080/pulp/api/v3/')\nPULP_USERNAME = os.environ.get('PULP_USERNAME', 'admin')\nPULP_PASSWORD = os.environ.get('PULP_PASSWORD', 'password')\n\ntry:\n    # 1. Establish a connection\n    # In production, ensure verify_ssl=True with valid certs\n    connection = PulpConnection(\n        base_url=PULP_BASE_URL,\n        basic_auth=(PULP_USERNAME, PULP_PASSWORD),\n        verify_ssl=False \n    )\n\n    # 2. Initialize the API client\n    api = PulpAPI(connection)\n\n    # 3. Perform a basic operation (e.g., list repositories)\n    print(f\"Connecting to Pulp at: {PULP_BASE_URL}\")\n    print(f\"Listing core repositories:\")\n    repositories = api.repositories_core.list()\n    for repo in repositories.results:\n        print(f\"  - {repo.name} (Pulp HREF: {repo.pulp_href})\")\n\nexcept httpx.HTTPStatusError as e:\n    print(f\"HTTP Error: {e.response.status_code} - {e.response.text}\")\n    print(\"Please check your Pulp URL, username, and password.\")\nexcept httpx.RequestError as e:\n    print(f\"Request Error: {e}\")\n    print(\"Could not connect to the Pulp server. Check the URL and server status.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This example demonstrates how to connect to a Pulp server using `PulpConnection` and `PulpAPI`, authenticate with basic credentials (from environment variables), and then list available core repositories. Adjust `PULP_BASE_URL`, `PULP_USERNAME`, and `PULP_PASSWORD` for your Pulp instance. Set `verify_ssl=True` in production if your server has a trusted certificate."},"warnings":[{"fix":"Ensure your environment uses Python 3.10 or newer (currently up to 3.14 is supported).","message":"Support for Python 3.6 was dropped in version 0.28.0, and Python 3.7 was dropped in version 0.33.0.","severity":"breaking","affected_versions":">=0.28.0, >=0.33.0"},{"fix":"For specific client access (e.g., `pulpcore`), import `get_client` directly from `pulp_glue.pulpcore.client`. For general API interaction, access resources directly via the `PulpAPI` object (e.g., `api.repositories_core`).","message":"The `PulpAPI.get_client()` method was deprecated in version 0.34.0.","severity":"deprecated","affected_versions":">=0.34.0"},{"fix":"When initializing `PulpConnection`, add `verify_ssl=False` for untrusted certificates, or ensure your server uses valid, trusted SSL certificates.","message":"The `verify_ssl` argument in `PulpConnection` now defaults to `True` since version 0.27.0. If you are using self-signed certificates or a development environment, you might need to set `verify_ssl=False` explicitly.","severity":"gotcha","affected_versions":">=0.27.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Import `get_client` from `pulp_glue.pulpcore.client` and call it directly, or interact with API resources directly via the `PulpAPI` object (e.g., `api.repositories_core.list()`).","cause":"Attempting to use the deprecated `get_client()` method directly on a `PulpAPI` instance.","error":"AttributeError: 'PulpAPI' object has no attribute 'get_client'"},{"fix":"Verify the Pulp server status and ensure the `PULP_BASE_URL` is correct and accessible from your client. Check network connectivity and firewall rules.","cause":"The Pulp server is not running or is unreachable at the specified `base_url`.","error":"httpx.ConnectError: [Errno 111] Connection refused (or similar 'Connection refused')"},{"fix":"Double-check `PULP_USERNAME` and `PULP_PASSWORD` are correct for your Pulp instance.","cause":"Incorrect username or password provided for basic authentication to the Pulp server.","error":"httpx.HTTPStatusError: Client error '401 Unauthorized' for url: ..."},{"fix":"For development or testing, set `verify_ssl=False` in the `PulpConnection` constructor. For production, ensure the server uses a valid, trusted SSL certificate and that your system's certificate authorities are up-to-date.","cause":"The SSL certificate of the Pulp server cannot be verified, often due to self-signed certificates or misconfiguration in a development environment.","error":"httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed"}]}