apify 2.7.1b18__py3-none-any.whl → 2.7.1b19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of apify might be problematic. Click here for more details.

@@ -5,7 +5,7 @@ from typing import Annotated
5
5
 
6
6
  from pydantic import BaseModel, ConfigDict, Field
7
7
 
8
- from crawlee.storage_clients.models import KeyValueStoreMetadata
8
+ from crawlee.storage_clients.models import KeyValueStoreMetadata, RequestQueueMetadata
9
9
 
10
10
  from apify import Request
11
11
  from apify._utils import docs_group
@@ -105,3 +105,27 @@ class CachedRequest(BaseModel):
105
105
 
106
106
  lock_expires_at: datetime | None = None
107
107
  """The expiration time of the lock on the request."""
108
+
109
+
110
+ class RequestQueueStats(BaseModel):
111
+ model_config = ConfigDict(populate_by_name=True)
112
+
113
+ delete_count: Annotated[int, Field(alias='deleteCount', default=0)]
114
+ """"The number of request queue deletes."""
115
+
116
+ head_item_read_count: Annotated[int, Field(alias='headItemReadCount', default=0)]
117
+ """The number of request queue head reads."""
118
+
119
+ read_count: Annotated[int, Field(alias='readCount', default=0)]
120
+ """The number of request queue reads."""
121
+
122
+ storage_bytes: Annotated[int, Field(alias='storageBytes', default=0)]
123
+ """Storage size in Bytes."""
124
+
125
+ write_count: Annotated[int, Field(alias='writeCount', default=0)]
126
+ """The number of request queue writes."""
127
+
128
+
129
+ class ApifyRequestQueueMetadata(RequestQueueMetadata):
130
+ stats: Annotated[RequestQueueStats, Field(alias='stats', default_factory=RequestQueueStats)]
131
+ """Additional statistics about the request queue."""
@@ -18,7 +18,13 @@ from crawlee.storage_clients._base import RequestQueueClient
18
18
  from crawlee.storage_clients.models import AddRequestsResponse, ProcessedRequest, RequestQueueMetadata
19
19
  from crawlee.storages import RequestQueue
20
20
 
21
- from ._models import CachedRequest, ProlongRequestLockResponse, RequestQueueHead
21
+ from ._models import (
22
+ ApifyRequestQueueMetadata,
23
+ CachedRequest,
24
+ ProlongRequestLockResponse,
25
+ RequestQueueHead,
26
+ RequestQueueStats,
27
+ )
22
28
  from ._utils import AliasResolver
23
29
  from apify import Request
24
30
 
@@ -108,7 +114,7 @@ class ApifyRequestQueueClient(RequestQueueClient):
108
114
  return self._metadata
109
115
 
110
116
  @override
111
- async def get_metadata(self) -> RequestQueueMetadata:
117
+ async def get_metadata(self) -> ApifyRequestQueueMetadata:
112
118
  """Get metadata about the request queue.
113
119
 
114
120
  Returns:
@@ -119,7 +125,7 @@ class ApifyRequestQueueClient(RequestQueueClient):
119
125
  if response is None:
120
126
  raise ValueError('Failed to fetch request queue metadata from the API.')
121
127
  # Enhance API response by local estimations (API can be delayed few seconds, while local estimation not.)
122
- return RequestQueueMetadata(
128
+ return ApifyRequestQueueMetadata(
123
129
  id=response['id'],
124
130
  name=response['name'],
125
131
  total_request_count=max(response['totalRequestCount'], self._metadata.total_request_count),
@@ -129,6 +135,7 @@ class ApifyRequestQueueClient(RequestQueueClient):
129
135
  modified_at=max(response['modifiedAt'], self._metadata.modified_at),
130
136
  accessed_at=max(response['accessedAt'], self._metadata.accessed_at),
131
137
  had_multiple_clients=response['hadMultipleClients'] or self._metadata.had_multiple_clients,
138
+ stats=RequestQueueStats.model_validate(response['stats'], by_alias=True),
132
139
  )
133
140
 
134
141
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apify
3
- Version: 2.7.1b18
3
+ Version: 2.7.1b19
4
4
  Summary: Apify SDK for Python
5
5
  Project-URL: Apify Homepage, https://apify.com
6
6
  Project-URL: Changelog, https://docs.apify.com/sdk/python/docs/changelog
@@ -37,8 +37,8 @@ apify/storage_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
37
37
  apify/storage_clients/_apify/__init__.py,sha256=mtbVDsxqWL3kx30elnh0kAn2kZ4s3BBsWa15Y5e7RMU,347
38
38
  apify/storage_clients/_apify/_dataset_client.py,sha256=aKQsoIDLbuP6R8wo2DX6pzp-EHV5EWZlHWB8s8OLuG4,12096
39
39
  apify/storage_clients/_apify/_key_value_store_client.py,sha256=EWcWE6HiXBGklCAilj4My3T95py7Nu6Zt3e_XzpySUM,10099
40
- apify/storage_clients/_apify/_models.py,sha256=C6FpXswtO6kXE5RUumazm_conzJJS6PrXAGF9XBuDb8,3651
41
- apify/storage_clients/_apify/_request_queue_client.py,sha256=4m7Evp0d_f-1rjatmyYIwnYYG3PGtNCBjw5TFiU0H0w,32640
40
+ apify/storage_clients/_apify/_models.py,sha256=GEaN7Got1zIg42QPH36obHRWRDVNtzOkRuOWYRf9bFU,4572
41
+ apify/storage_clients/_apify/_request_queue_client.py,sha256=fkjdA0Kaq8CquiTfWOKGXxXqbTB1nNWDQ9wL98g0nTg,32807
42
42
  apify/storage_clients/_apify/_storage_client.py,sha256=7oqn8-7zG7_cruw6jzmRl2htX2rOt-KPTzCRVNCcyTA,3304
43
43
  apify/storage_clients/_apify/_utils.py,sha256=1g0oGqHmB-AeNfeMiB33om2bRZ_7wwhpijPXdWRPNsM,6609
44
44
  apify/storage_clients/_apify/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -47,7 +47,7 @@ apify/storage_clients/_file_system/_key_value_store_client.py,sha256=fnSJ1EIOPCG
47
47
  apify/storage_clients/_file_system/_storage_client.py,sha256=rcwpKYlrWzvlSA2xoxftg-EZAi_iGZ3vOCbu0C5lKDE,1396
48
48
  apify/storages/__init__.py,sha256=-9tEYJVabVs_eRVhUehxN58GH0UG8OfuGjGwuDieP2M,122
49
49
  apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- apify-2.7.1b18.dist-info/METADATA,sha256=JJjECttKjzSG_t9zHcmc5CBlfwV2u3RuknNEOhXOEVY,22580
51
- apify-2.7.1b18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
- apify-2.7.1b18.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
53
- apify-2.7.1b18.dist-info/RECORD,,
50
+ apify-2.7.1b19.dist-info/METADATA,sha256=XVHTFOiCHcLju1Im2srBp_IoV7ZZ6tk5snx8HrWpFoM,22580
51
+ apify-2.7.1b19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
+ apify-2.7.1b19.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
53
+ apify-2.7.1b19.dist-info/RECORD,,