|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import json as jsonlib |
4 | | -import warnings |
5 | 4 | from contextlib import asynccontextmanager, contextmanager |
6 | 5 | from http import HTTPStatus |
7 | 6 | from typing import TYPE_CHECKING, Any |
@@ -102,43 +101,18 @@ def list_keys( |
102 | 101 |
|
103 | 102 | return parse_date_fields(pluck_data(jsonlib.loads(response.text))) |
104 | 103 |
|
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: |
106 | 105 | """Retrieve the given record from the key-value store. |
107 | 106 |
|
108 | 107 | https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record |
109 | 108 |
|
110 | 109 | Args: |
111 | 110 | 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. |
116 | 111 |
|
117 | 112 | Returns: |
118 | 113 | The requested record, or None, if the record does not exist. |
119 | 114 | """ |
120 | 115 | 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 | | - |
142 | 116 | response = self.http_client.call( |
143 | 117 | url=self._url(f'records/{key}'), |
144 | 118 | method='GET', |
@@ -377,10 +351,6 @@ async def get_record(self, key: str) -> dict | None: |
377 | 351 |
|
378 | 352 | Args: |
379 | 353 | 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. |
384 | 354 |
|
385 | 355 | Returns: |
386 | 356 | The requested record, or None, if the record does not exist. |
|
0 commit comments