{"id":8032,"library":"conjure-python-client","title":"Conjure Python Client","description":"The Conjure Python Client (conjure-python-client) is a Python library that provides a simple interface for executing statically typed remote procedure calls (RPC) from Python. It acts as the RPC layer for clients generated by the `conjure-python` toolchain, leveraging the `requests` library for HTTP communication. Currently at version 3.3.0, the library is actively maintained with regular releases.","status":"active","version":"3.3.0","language":"en","source_language":"en","source_url":"https://github.com/palantir/conjure-python-client","tags":["client","rpc","api","palantir","code-generation"],"install":[{"cmd":"pip install conjure-python-client","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Main client for making HTTP requests to Conjure services.","symbol":"RequestsClient","correct":"from conjure_python_client import RequestsClient"},{"note":"Used to configure service endpoints and other client-wide settings.","symbol":"ServiceConfiguration","correct":"from conjure_python_client import ServiceConfiguration"}],"quickstart":{"code":"import os\nfrom conjure_python_client import RequestsClient, ServiceConfiguration\n\n# Assume 'MyGeneratedService' is a service interface generated by conjure-python\n# and imported from your project or another package.\n# Example: from my_api_client import MyGeneratedService\n\n# Define a dummy service for demonstration if MyGeneratedService isn't available\nclass MyGeneratedService:\n    def __init__(self, client):\n        self._client = client\n    \n    def get_data(self, auth_header, query_param):\n        print(f\"Making GET request for data with param: {query_param}\")\n        # In a real scenario, this would call self._client._request(...)\n        if auth_header == 'Bearer valid-token':\n            return f\"Successfully retrieved data for '{query_param}'\"\n        else:\n            raise ValueError(\"Invalid authentication\")\n\n\n# Configure the service client\nconfig = ServiceConfiguration()\nconfig.uris = [os.environ.get('CONJURE_API_URI', 'http://localhost:8080/api')]\n\n# Replace 'MyGeneratedService' with your actual generated service class\ntry:\n    service = RequestsClient.create(\n        MyGeneratedService,\n        user_agent=\"my-application/1.0.0\",\n        service_config=config\n    )\n\n    # Example usage: making an authenticated call\n    auth_token = os.environ.get('CONJURE_AUTH_TOKEN', 'valid-token')\n    auth_header = f\"Bearer {auth_token}\"\n    result = service.get_data(auth_header, query_param=\"example_id\")\n    print(result)\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize a Conjure client for a generated service. It configures the `RequestsClient` with service URIs and a user agent, then shows how to call a method on a hypothetical generated service interface, including passing an authentication header. The `MyGeneratedService` placeholder should be replaced with an actual service client class generated by the `conjure-python` toolchain for your specific API definition."},"warnings":[{"fix":"Review your `conjure-python` generated client code for any implicit dependencies or behavior changes. Update your `conjure-python` generator if applicable to ensure compatibility.","message":"Version 3.0.0 was a major version bump, though its release notes for `conjure-python-client` indicated 'No documented user-facing changes'. However, major version changes often imply potential underlying shifts, especially as this client underpins code generated by `conjure-python`. Users upgrading from 2.x should exercise caution and thoroughly test their generated client integrations.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Upgrade to `conjure-python-client` version 3.2.0 or newer. If upgrading is not immediately possible, consider handling errors in the child process or serializing/deserializing error details manually.","message":"Older versions (pre-3.2.0) of `ConjureHTTPError` could cause `PicklingError` when used in Python's `multiprocessing` module due to issues with its `__reduce__` method. This made passing these error objects between processes problematic.","severity":"gotcha","affected_versions":"<3.2.0"},{"fix":"Upgrade to `conjure-python-client` version 3.3.0 or higher to ensure full compatibility and proper functionality on Windows environments.","message":"Prior to version 3.3.0, `conjure-python-client` might have had limited or broken compatibility when running on Windows operating systems.","severity":"gotcha","affected_versions":"<3.3.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Upgrade `conjure-python-client` to version 3.2.0 or newer: `pip install --upgrade conjure-python-client`.","cause":"Attempting to pass an instance of `ConjureHTTPError` between processes using Python's `multiprocessing` module with an older version of `conjure-python-client` (pre-3.2.0). The error object was not properly picklable.","error":"TypeError: can't pickle 'ConjureHTTPError' object"},{"fix":"Verify that the `Authorization` header is correctly formatted (e.g., 'Bearer <token>') and contains a valid, unexpired token. Ensure the client's credentials have the necessary permissions defined in your Conjure service policy. Check environment variables for token/key correctness.","cause":"Incorrect or expired authentication credentials, missing `Authorization` header, or insufficient permissions for the client to access the requested Conjure service endpoint.","error":"HTTP 401 Unauthorized / HTTP 403 Forbidden"},{"fix":"Inspect the raw JSON response from the server to identify discrepancies. Regenerate your client code using the latest API definitions (`conjure-python`). Implement robust error handling for missing fields if the API contract allows for optionality or transient states.","cause":"The JSON response from the Conjure service is missing an expected field, or there's a mismatch between the expected schema in the generated client and the actual data received. This can happen if the service API changes without a corresponding update to the client's API definition or if the service returns an unexpected error format.","error":"KeyError: 'some_expected_field_name' (during deserialization)"}]}