|
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 |
@@ -101,43 +100,18 @@ def list_keys( |
101 | 100 |
|
102 | 101 | return parse_date_fields(pluck_data(response.json())) |
103 | 102 |
|
104 | | - def get_record(self, key: str, *, as_bytes: bool = False, as_file: bool = False) -> dict | None: |
| 103 | + def get_record(self, key: str) -> dict | None: |
105 | 104 | """Retrieve the given record from the key-value store. |
106 | 105 |
|
107 | 106 | https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record |
108 | 107 |
|
109 | 108 | Args: |
110 | 109 | key: Key of the record to retrieve. |
111 | | - as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes, |
112 | | - default False. |
113 | | - as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object, |
114 | | - default False. |
115 | 110 |
|
116 | 111 | Returns: |
117 | 112 | The requested record, or None, if the record does not exist. |
118 | 113 | """ |
119 | 114 | try: |
120 | | - if as_bytes and as_file: |
121 | | - raise ValueError('You cannot have both as_bytes and as_file set.') |
122 | | - |
123 | | - if as_bytes: |
124 | | - warnings.warn( |
125 | | - '`KeyValueStoreClient.get_record(..., as_bytes=True)` is deprecated, ' |
126 | | - 'use `KeyValueStoreClient.get_record_as_bytes()` instead.', |
127 | | - DeprecationWarning, |
128 | | - stacklevel=2, |
129 | | - ) |
130 | | - return self.get_record_as_bytes(key) |
131 | | - |
132 | | - if as_file: |
133 | | - warnings.warn( |
134 | | - '`KeyValueStoreClient.get_record(..., as_file=True)` is deprecated, ' |
135 | | - 'use `KeyValueStoreClient.stream_record()` instead.', |
136 | | - DeprecationWarning, |
137 | | - stacklevel=2, |
138 | | - ) |
139 | | - return self.stream_record(key) # type: ignore[return-value] |
140 | | - |
141 | 115 | response = self.http_client.call( |
142 | 116 | url=self._url(f'records/{key}'), |
143 | 117 | method='GET', |
@@ -376,10 +350,6 @@ async def get_record(self, key: str) -> dict | None: |
376 | 350 |
|
377 | 351 | Args: |
378 | 352 | key: Key of the record to retrieve. |
379 | | - as_bytes: Deprecated, use `get_record_as_bytes()` instead. Whether to retrieve the record as raw bytes, |
380 | | - default False. |
381 | | - as_file: Deprecated, use `stream_record()` instead. Whether to retrieve the record as a file-like object, |
382 | | - default False. |
383 | 353 |
|
384 | 354 | Returns: |
385 | 355 | The requested record, or None, if the record does not exist. |
|
0 commit comments