arpakitlib 1.8.48__py3-none-any.whl → 1.8.50__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.
@@ -78,7 +78,7 @@ class ZabbixApiClient:
78
78
  kwargs["sortorder"] = "DESC"
79
79
  return [host_id["hostid"] for host_id in host_ids]
80
80
 
81
- def get_hosts(self, *, host_ids: Optional[list[str]] = None) -> list[dict[str, Any]]:
81
+ def get_hosts(self, *, host_ids: Optional[list[str | int]] = None) -> list[dict[str, Any]]:
82
82
  kwargs = {
83
83
  "output": "extend",
84
84
  "selectInterfaces": "extend",
@@ -116,7 +116,7 @@ class ZabbixApiClient:
116
116
  def get_item_ids(
117
117
  self,
118
118
  *,
119
- host_ids: Optional[list[str]] = None,
119
+ host_ids: Optional[list[str | int]] = None,
120
120
  keys: Optional[list[str]] = None,
121
121
  names: Optional[list[str]] = None,
122
122
  limit: Optional[int] = None
@@ -148,8 +148,8 @@ class ZabbixApiClient:
148
148
  def get_items(
149
149
  self,
150
150
  *,
151
- host_ids: Optional[list[str]] = None,
152
- item_ids: Optional[list[str]] = None,
151
+ host_ids: Optional[list[str | int]] = None,
152
+ item_ids: Optional[list[str | int]] = None,
153
153
  keys: Optional[list[str]] = None,
154
154
  names: Optional[list[str]] = None,
155
155
  limit: Optional[int] = None
@@ -182,11 +182,49 @@ class ZabbixApiClient:
182
182
  res = self.zabbix_api.item.get(**kwargs)
183
183
  return res
184
184
 
185
+ def iter_all_items(
186
+ self,
187
+ *,
188
+ host_ids: Optional[list[str | int]] = None,
189
+ keys: Optional[list[str]] = None,
190
+ names: Optional[list[str]] = None
191
+ ) -> Iterator[list[dict[str, Any]]]:
192
+ item_ids = self.get_item_ids(
193
+ host_ids=host_ids,
194
+ keys=keys,
195
+ names=names
196
+ )
197
+ for item_ids_ in iter_group_list(item_ids, n=100):
198
+ yield self.get_items(item_ids=item_ids_)
199
+
200
+ def iter_all_items_by_one(
201
+ self,
202
+ *,
203
+ host_ids: Optional[list[str | int]] = None,
204
+ keys: Optional[list[str]] = None,
205
+ names: Optional[list[str]] = None
206
+ ) -> Iterator[dict[str, Any]]:
207
+ for items in self.iter_all_items(host_ids=host_ids, keys=keys, names=names):
208
+ for item in items:
209
+ yield item
210
+
211
+ def get_all_items(
212
+ self,
213
+ *,
214
+ host_ids: list[str | int] | None = None,
215
+ keys: list[str] | None = None,
216
+ names: list[str] | None = None
217
+ ) -> list[dict[str, Any]]:
218
+ return [
219
+ item
220
+ for item in self.iter_all_items_by_one(host_ids=host_ids, keys=keys, names=names)
221
+ ]
222
+
185
223
  def get_histories(
186
224
  self,
187
225
  *,
188
- host_ids: Optional[list[str]] = None,
189
- item_ids: Optional[list[str]] = None,
226
+ host_ids: Optional[list[str | int]] = None,
227
+ item_ids: Optional[list[str | int]] = None,
190
228
  limit: Optional[int] = None,
191
229
  history: int = 0,
192
230
  time_from: Optional[datetime] = None,
@@ -235,13 +273,6 @@ ZabbixAPIClient = ZabbixApiClient
235
273
 
236
274
  def __example():
237
275
  setup_normal_logging()
238
- zabbix = ZabbixAPIClient(
239
- api_url=...,
240
- api_user=...,
241
- api_password=...
242
- )
243
-
244
- print(zabbix.is_login_good())
245
276
 
246
277
 
247
278
  async def __async_example():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.8.48
3
+ Version: 1.8.50
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
@@ -368,9 +368,9 @@ arpakitlib/ar_str_util.py,sha256=QWlXMYgGOh_m0uXwUywF9R6g_zJ0Rh9YSfU_eVzPh7g,420
368
368
  arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
369
369
  arpakitlib/ar_wata_api_client.py,sha256=gdHOqDbuqxhTjVDtRW1DvkRJLdDofCrOq51GTctzLns,242
370
370
  arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
371
- arpakitlib/ar_zabbix_api_client_util.py,sha256=0JG-gIJ86-JI-vYRcgxXKFZp18B2_sK-pt4p7W9mvLU,8102
372
- arpakitlib-1.8.48.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
373
- arpakitlib-1.8.48.dist-info/METADATA,sha256=E0FQzGTF_K4-Kaz5pnof4M0lKpp-0H0ujrfaDjSBe5E,3475
374
- arpakitlib-1.8.48.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
375
- arpakitlib-1.8.48.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
376
- arpakitlib-1.8.48.dist-info/RECORD,,
371
+ arpakitlib/ar_zabbix_api_client_util.py,sha256=eb4Tach4y0mgEPVgTig6XR5xVOk6e0IFZI7Gwdtmlxw,9240
372
+ arpakitlib-1.8.50.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
373
+ arpakitlib-1.8.50.dist-info/METADATA,sha256=4a2FYET8lHiY-JXqbpkCMmSiPIdRCL81R9Jog2vKc-8,3475
374
+ arpakitlib-1.8.50.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
375
+ arpakitlib-1.8.50.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
376
+ arpakitlib-1.8.50.dist-info/RECORD,,