Skip to content

Commit d8211dd

Browse files
committed
chore: remove deprecated functions
1 parent 8ecd4d3 commit d8211dd

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## Next Release
44

5+
- Drops support for Python 3.7
56
- Fixes the payload wrapping for updating a webhook
7+
- Removes deprecated `user.all_api_keys` and `user.api_keys`, use `api_key.all` and `api_key.retrieve_api_keys_for_user` respectively
8+
- Bumps all dev dependencies
69

710
## v9.5.0 (2024-10-24)
811

easypost/services/user_service.py

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
from typing import (
22
Any,
33
Dict,
4-
List,
54
Optional,
65
)
7-
from warnings import warn
86

97
from easypost.easypost_object import convert_to_easypost_object
10-
from easypost.models import (
11-
ApiKey,
12-
User,
13-
)
8+
from easypost.models import User
149
from easypost.requestor import (
1510
RequestMethod,
1611
Requestor,
@@ -67,45 +62,6 @@ def retrieve_me(self) -> User:
6762

6863
return convert_to_easypost_object(response=response)
6964

70-
def all_api_keys(self) -> Dict[str, Any]:
71-
"""Retrieve a list of all API keys."""
72-
warn(
73-
'This method is deprecated, use the "all" function of "api_keys" on the client instead.',
74-
DeprecationWarning,
75-
stacklevel=2,
76-
)
77-
78-
url = "/api_keys"
79-
80-
response = Requestor(self._client).request(method=RequestMethod.GET, url=url)
81-
82-
return convert_to_easypost_object(response=response)
83-
84-
def api_keys(self, id: str) -> List[ApiKey]:
85-
"""Retrieve a list of API keys (works for the authenticated User or a child User)."""
86-
warn(
87-
'This method is deprecated, use the "retrieve_api_keys_for_user" function '
88-
'of "api_keys" on the client instead.',
89-
DeprecationWarning,
90-
stacklevel=2,
91-
)
92-
93-
api_keys = self.all_api_keys()
94-
my_api_keys = []
95-
96-
if api_keys["id"] == id:
97-
# This function was called on the authenticated user
98-
my_api_keys = api_keys["keys"]
99-
else:
100-
# This function was called on a child user (authenticated as parent, only return
101-
# this child user's details).
102-
for child in api_keys["children"]:
103-
if child.id == id:
104-
my_api_keys = child.keys
105-
break
106-
107-
return my_api_keys
108-
10965
def update_brand(self, id: str, **params) -> User:
11066
"""Update a User's Brand."""
11167
url = self._instance_url(self._model_class, id) + "/brand"

0 commit comments

Comments
 (0)