|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -import warnings |
4 | 3 | from contextlib import asynccontextmanager, contextmanager |
5 | 4 | from http import HTTPStatus |
6 | 5 | from typing import TYPE_CHECKING, Any |
@@ -106,43 +105,18 @@ def list_keys( |
106 | 105 |
|
107 | 106 | return parse_date_fields(pluck_data(response.json())) |
108 | 107 |
|
109 | | - def get_record(self, key: str, *, as_bytes: bool = False, as_file: bool = False) -> dict | None: |
| 108 | + def get_record(self, key: str) -> dict | None: |
110 | 109 | """Retrieve the given record from the key-value store. |
111 | 110 |
|
112 | 111 | https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record |
113 | 112 |
|
114 | 113 | Args: |
115 | 114 | key: Key of the record to retrieve. |
116 | | - as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes, |
117 | | - default False. |
118 | | - as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object, |
119 | | - default False. |
120 | 115 |
|
121 | 116 | Returns: |
122 | 117 | The requested record, or None, if the record does not exist. |
123 | 118 | """ |
124 | 119 | try: |
125 | | - if as_bytes and as_file: |
126 | | - raise ValueError('You cannot have both as_bytes and as_file set.') |
127 | | - |
128 | | - if as_bytes: |
129 | | - warnings.warn( |
130 | | - '`KeyValueStoreClient.get_record(..., as_bytes=True)` is deprecated, ' |
131 | | - 'use `KeyValueStoreClient.get_record_as_bytes()` instead.', |
132 | | - DeprecationWarning, |
133 | | - stacklevel=2, |
134 | | - ) |
135 | | - return self.get_record_as_bytes(key) |
136 | | - |
137 | | - if as_file: |
138 | | - warnings.warn( |
139 | | - '`KeyValueStoreClient.get_record(..., as_file=True)` is deprecated, ' |
140 | | - 'use `KeyValueStoreClient.stream_record()` instead.', |
141 | | - DeprecationWarning, |
142 | | - stacklevel=2, |
143 | | - ) |
144 | | - return self.stream_record(key) # type: ignore[return-value] |
145 | | - |
146 | 120 | response = self.http_client.call( |
147 | 121 | url=self._url(f'records/{key}'), |
148 | 122 | method='GET', |
@@ -379,10 +353,6 @@ async def get_record(self, key: str) -> dict | None: |
379 | 353 |
|
380 | 354 | Args: |
381 | 355 | key: Key of the record to retrieve. |
382 | | - as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes, |
383 | | - default False. |
384 | | - as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object, |
385 | | - default False. |
386 | 356 |
|
387 | 357 | Returns: |
388 | 358 | The requested record, or None, if the record does not exist. |
|
0 commit comments