From 081569296fe1768d84bf9e3297d9cb7e98486dd9 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Date: Mon, 24 Aug 2026 15:11:11 +0700 Subject: [PATCH] fix(python): use client.api_keys service in API Keys examples The Python client registers the API Key service as `client.api_keys` (`self.api_keys = ApiKeyService(self)`), while `client.api_key` is the configured API key *string*. Calling `client.api_key.all()` therefore raises `AttributeError: 'str' object has no attribute 'all'`. Fixes both call sites (`all` and `retrieve_api_keys_for_user`) across the current, v9, and v8 example directories. The `api_keys` property has been correct since easypost-python v8.2.0, so all three are affected. Ruby is intentionally left unchanged: it derives accessors from class names (`Services::ApiKey` -> `client.api_key`), so the Ruby examples are correct. DOCS-527 --- official/docs/python/current/api-keys/retrieve.py | 4 ++-- official/docs/python/v8/api-keys/retrieve.py | 4 ++-- official/docs/python/v9/api-keys/retrieve.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/official/docs/python/current/api-keys/retrieve.py b/official/docs/python/current/api-keys/retrieve.py index 028955ff..da8c7bfc 100644 --- a/official/docs/python/current/api-keys/retrieve.py +++ b/official/docs/python/current/api-keys/retrieve.py @@ -3,11 +3,11 @@ client = easypost.EasyPostClient("EASYPOST_API_KEY") # Retrieve all API keys including children -api_keys = client.api_key.all() +api_keys = client.api_keys.all() print(api_keys) # Retrieve API keys for a specific child user -child_api_keys = client.api_key.retrieve_api_keys_for_user("user_...") +child_api_keys = client.api_keys.retrieve_api_keys_for_user("user_...") print(child_api_keys) diff --git a/official/docs/python/v8/api-keys/retrieve.py b/official/docs/python/v8/api-keys/retrieve.py index 028955ff..da8c7bfc 100644 --- a/official/docs/python/v8/api-keys/retrieve.py +++ b/official/docs/python/v8/api-keys/retrieve.py @@ -3,11 +3,11 @@ client = easypost.EasyPostClient("EASYPOST_API_KEY") # Retrieve all API keys including children -api_keys = client.api_key.all() +api_keys = client.api_keys.all() print(api_keys) # Retrieve API keys for a specific child user -child_api_keys = client.api_key.retrieve_api_keys_for_user("user_...") +child_api_keys = client.api_keys.retrieve_api_keys_for_user("user_...") print(child_api_keys) diff --git a/official/docs/python/v9/api-keys/retrieve.py b/official/docs/python/v9/api-keys/retrieve.py index 028955ff..da8c7bfc 100644 --- a/official/docs/python/v9/api-keys/retrieve.py +++ b/official/docs/python/v9/api-keys/retrieve.py @@ -3,11 +3,11 @@ client = easypost.EasyPostClient("EASYPOST_API_KEY") # Retrieve all API keys including children -api_keys = client.api_key.all() +api_keys = client.api_keys.all() print(api_keys) # Retrieve API keys for a specific child user -child_api_keys = client.api_key.retrieve_api_keys_for_user("user_...") +child_api_keys = client.api_keys.retrieve_api_keys_for_user("user_...") print(child_api_keys)