Skip to content

Commit b880231

Browse files
authored
refactor!: Remove deprecated as_bytes and as_file parameters from KeyValueStoreClient.get_record (#463)
- Remove deprecated parameters `as_bytes` and `as_file` from the `get_record` method in `KeyValueStoreClient`. This ensures consistency with `KeyValueStoreClientAsync`, where these parameters were previously removed from the method signature.
1 parent c0cc147 commit b880231

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/apify_client/clients/resource_clients/key_value_store.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import json as jsonlib
4-
import warnings
54
from contextlib import asynccontextmanager, contextmanager
65
from http import HTTPStatus
76
from typing import TYPE_CHECKING, Any
@@ -102,43 +101,18 @@ def list_keys(
102101

103102
return parse_date_fields(pluck_data(jsonlib.loads(response.text)))
104103

105-
def get_record(self, key: str, *, as_bytes: bool = False, as_file: bool = False) -> dict | None:
104+
def get_record(self, key: str) -> dict | None:
106105
"""Retrieve the given record from the key-value store.
107106
108107
https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record
109108
110109
Args:
111110
key: Key of the record to retrieve.
112-
as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes,
113-
default False.
114-
as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object,
115-
default False.
116111
117112
Returns:
118113
The requested record, or None, if the record does not exist.
119114
"""
120115
try:
121-
if as_bytes and as_file:
122-
raise ValueError('You cannot have both as_bytes and as_file set.')
123-
124-
if as_bytes:
125-
warnings.warn(
126-
'`KeyValueStoreClient.get_record(..., as_bytes=True)` is deprecated, '
127-
'use `KeyValueStoreClient.get_record_as_bytes()` instead.',
128-
DeprecationWarning,
129-
stacklevel=2,
130-
)
131-
return self.get_record_as_bytes(key)
132-
133-
if as_file:
134-
warnings.warn(
135-
'`KeyValueStoreClient.get_record(..., as_file=True)` is deprecated, '
136-
'use `KeyValueStoreClient.stream_record()` instead.',
137-
DeprecationWarning,
138-
stacklevel=2,
139-
)
140-
return self.stream_record(key) # type: ignore[return-value]
141-
142116
response = self.http_client.call(
143117
url=self._url(f'records/{key}'),
144118
method='GET',
@@ -377,10 +351,6 @@ async def get_record(self, key: str) -> dict | None:
377351
378352
Args:
379353
key: Key of the record to retrieve.
380-
as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes,
381-
default False.
382-
as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object,
383-
default False.
384354
385355
Returns:
386356
The requested record, or None, if the record does not exist.

0 commit comments

Comments
 (0)