|
9 | 9 |
|
10 | 10 | from apify_client import ApifyClientAsync
|
11 | 11 | from crawlee.storage_clients._base import KeyValueStoreClient
|
12 |
| -from crawlee.storage_clients.models import KeyValueStoreMetadata, KeyValueStoreRecord, KeyValueStoreRecordMetadata |
| 12 | +from crawlee.storage_clients.models import KeyValueStoreRecord, KeyValueStoreRecordMetadata |
13 | 13 |
|
14 |
| -from ._models import KeyValueStoreListKeysPage |
| 14 | +from ._models import ApifyKeyValueStoreMetadata, KeyValueStoreListKeysPage |
15 | 15 | from apify._crypto import create_hmac_signature
|
16 | 16 |
|
17 | 17 | if TYPE_CHECKING:
|
@@ -48,9 +48,9 @@ def __init__(
|
48 | 48 | """A lock to ensure that only one operation is performed at a time."""
|
49 | 49 |
|
50 | 50 | @override
|
51 |
| - async def get_metadata(self) -> KeyValueStoreMetadata: |
| 51 | + async def get_metadata(self) -> ApifyKeyValueStoreMetadata: |
52 | 52 | metadata = await self._api_client.get()
|
53 |
| - return KeyValueStoreMetadata.model_validate(metadata) |
| 53 | + return ApifyKeyValueStoreMetadata.model_validate(metadata) |
54 | 54 |
|
55 | 55 | @classmethod
|
56 | 56 | async def open(
|
@@ -112,7 +112,7 @@ async def open(
|
112 | 112 |
|
113 | 113 | # If name is provided, get or create the storage by name.
|
114 | 114 | if name is not None and id is None:
|
115 |
| - id = KeyValueStoreMetadata.model_validate( |
| 115 | + id = ApifyKeyValueStoreMetadata.model_validate( |
116 | 116 | await apify_kvss_client.get_or_create(name=name),
|
117 | 117 | ).id
|
118 | 118 |
|
@@ -219,9 +219,7 @@ async def get_public_url(self, key: str) -> str:
|
219 | 219 | )
|
220 | 220 | metadata = await self.get_metadata()
|
221 | 221 |
|
222 |
| - if metadata.model_extra is not None: |
223 |
| - url_signing_secret_key = metadata.model_extra.get('urlSigningSecretKey') |
224 |
| - if url_signing_secret_key is not None: |
225 |
| - public_url = public_url.with_query(signature=create_hmac_signature(url_signing_secret_key, key)) |
| 222 | + if metadata.url_signing_secret_key is not None: |
| 223 | + public_url = public_url.with_query(signature=create_hmac_signature(metadata.url_signing_secret_key, key)) |
226 | 224 |
|
227 | 225 | return str(public_url)
|
0 commit comments