exa-py 1.11.0__py3-none-any.whl → 1.12.1__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 exa-py might be problematic. Click here for more details.

@@ -1,22 +1,60 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Optional
3
+ from typing import Optional, Dict, Any, Union, Literal
4
4
 
5
5
  from ..types import (
6
6
  CreateWebhookParameters,
7
7
  Webhook,
8
8
  ListWebhooksResponse,
9
9
  UpdateWebhookParameters,
10
+ ListWebhookAttemptsResponse,
11
+ EventType,
10
12
  )
11
13
  from ..core.base import WebsetsBaseClient
12
14
 
15
+ class WebhookAttemptsClient(WebsetsBaseClient):
16
+ """Client for managing Webhook Attempts."""
17
+
18
+ def __init__(self, client):
19
+ super().__init__(client)
20
+
21
+ def list(self, webhook_id: str, *, cursor: Optional[str] = None,
22
+ limit: Optional[int] = None, event_type: Optional[Union[EventType, str]] = None) -> ListWebhookAttemptsResponse:
23
+ """List all attempts made by a Webhook ordered in descending order.
24
+
25
+ Args:
26
+ webhook_id (str): The ID of the webhook.
27
+ cursor (str, optional): The cursor to paginate through the results.
28
+ limit (int, optional): The number of results to return (max 200).
29
+ event_type (Union[EventType, str], optional): The type of event to filter by.
30
+
31
+ Returns:
32
+ ListWebhookAttemptsResponse: List of webhook attempts.
33
+ """
34
+ event_type_value = None
35
+ if event_type is not None:
36
+ if isinstance(event_type, EventType):
37
+ event_type_value = event_type.value
38
+ else:
39
+ event_type_value = event_type
40
+
41
+ params = {k: v for k, v in {
42
+ "cursor": cursor,
43
+ "limit": limit,
44
+ "eventType": event_type_value
45
+ }.items() if v is not None}
46
+
47
+ response = self.request(f"/v0/webhooks/{webhook_id}/attempts", params=params, method="GET")
48
+ return ListWebhookAttemptsResponse.model_validate(response)
49
+
13
50
  class WebsetWebhooksClient(WebsetsBaseClient):
14
51
  """Client for managing Webset Webhooks."""
15
52
 
16
53
  def __init__(self, client):
17
54
  super().__init__(client)
55
+ self.attempts = WebhookAttemptsClient(client)
18
56
 
19
- def create(self, params: CreateWebhookParameters) -> Webhook:
57
+ def create(self, params: Union[Dict[str, Any], CreateWebhookParameters]) -> Webhook:
20
58
  """Create a Webhook.
21
59
 
22
60
  Args:
@@ -25,7 +63,7 @@ class WebsetWebhooksClient(WebsetsBaseClient):
25
63
  Returns:
26
64
  Webhook: The created webhook.
27
65
  """
28
- response = self.request("/v0/webhooks", data=params.model_dump(by_alias=True, exclude_none=True))
66
+ response = self.request("/v0/webhooks", data=params)
29
67
  return Webhook.model_validate(response)
30
68
 
31
69
  def get(self, id: str) -> Webhook:
@@ -54,7 +92,7 @@ class WebsetWebhooksClient(WebsetsBaseClient):
54
92
  response = self.request("/v0/webhooks", params=params, method="GET")
55
93
  return ListWebhooksResponse.model_validate(response)
56
94
 
57
- def update(self, id: str, params: UpdateWebhookParameters) -> Webhook:
95
+ def update(self, id: str, params: Union[Dict[str, Any], UpdateWebhookParameters]) -> Webhook:
58
96
  """Update a Webhook.
59
97
 
60
98
  Args:
@@ -64,7 +102,7 @@ class WebsetWebhooksClient(WebsetsBaseClient):
64
102
  Returns:
65
103
  Webhook: The updated webhook.
66
104
  """
67
- response = self.request(f"/v0/webhooks/{id}", data=params.model_dump(by_alias=True, exclude_none=True), method="PATCH")
105
+ response = self.request(f"/v0/webhooks/{id}", data=params, method="PATCH")
68
106
  return Webhook.model_validate(response)
69
107
 
70
108
  def delete(self, id: str) -> Webhook:
@@ -77,4 +115,4 @@ class WebsetWebhooksClient(WebsetsBaseClient):
77
115
  Webhook: The deleted webhook.
78
116
  """
79
117
  response = self.request(f"/v0/webhooks/{id}", method="DELETE")
80
- return Webhook.model_validate(response)
118
+ return Webhook.model_validate(response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: exa-py
3
- Version: 1.11.0
3
+ Version: 1.12.1
4
4
  Summary: Python SDK for Exa API.
5
5
  License: MIT
6
6
  Author: Exa AI
@@ -1,22 +1,21 @@
1
1
  exa_py/__init__.py,sha256=M2GC9oSdoV6m2msboW0vMWWl8wrth4o6gmEV4MYLGG8,66
2
- exa_py/api.py,sha256=u9HjGGqN3yzWjXiWE79OW630zA01TzO99iprAeWHOhQ,83244
2
+ exa_py/api.py,sha256=pY--ciwm4n8Mx7ojf8OF24piFjjd7WPT1M3U7yARV-M,83941
3
3
  exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
5
5
  exa_py/websets/__init__.py,sha256=uOBAb9VrIHrPKoddGOp2ai2KgWlyUVCLMZqfbGOlboA,70
6
6
  exa_py/websets/_generator/pydantic/BaseModel.jinja2,sha256=RUDCmPZVamoVx1WudylscYFfDhGoNNtRYlpTvKjAiuA,1276
7
- exa_py/websets/client.py,sha256=2CWf0DrkmtEJgveR-tz6FqjQbzi1NzlPRCIU2ANB8IE,4380
7
+ exa_py/websets/client.py,sha256=GWHebkvfiGY46sIuksAhYE1RLJrHQVS2PGhlA3xbxhE,4757
8
8
  exa_py/websets/core/__init__.py,sha256=xOyrFaqtBocMUu321Jpbk7IzIQRNZufSIGJXrKoG-Bg,323
9
- exa_py/websets/core/base.py,sha256=bKmOwims3i78d1Mzizpya421k4LB-0YnXuX5pHKxoFo,1300
9
+ exa_py/websets/core/base.py,sha256=2vCkPLEKI2K2U7d-76kqVL7qyye007iDdp15GseJN1c,3936
10
10
  exa_py/websets/enrichments/__init__.py,sha256=5dJIEKKceUost3RnI6PpCSB3VjUCBzxseEsIXu-ZY-Y,83
11
- exa_py/websets/enrichments/client.py,sha256=cnw0Va9fJQ9H9x0l1KwVB9EdKBb7mbV5ulAOmHuf3lE,2323
11
+ exa_py/websets/enrichments/client.py,sha256=obUjn4vH6tKBMtHEBVdMzlN8in0Fx3sCP-bXx-Le1zM,2338
12
12
  exa_py/websets/items/__init__.py,sha256=DCWZJVtRmUjnMEkKdb5gW1LT9cHcb-J8lENMnyyBeKU,71
13
13
  exa_py/websets/items/client.py,sha256=oZoYr52WrE76Ox6GyoS9rMn7bTrIpno0FKgIWFtb57U,2796
14
14
  exa_py/websets/searches/__init__.py,sha256=_0Zx8ES5fFTEL3T8mhLxq_xK2t0JONx6ad6AtbvClsE,77
15
- exa_py/websets/searches/client.py,sha256=elDZxycmKToOPU-F2utP2ia9x5m68vEu_5ymypcCV3A,1775
16
- exa_py/websets/types.py,sha256=njlUgvZJab8hg2_6tqYa5SYvuYowDNKP9MKrmV2PSq0,26559
15
+ exa_py/websets/searches/client.py,sha256=X3f7axWGfecmxf-2tBTX0Yf_--xToz1X8ZHbbudEzy0,1790
16
+ exa_py/websets/types.py,sha256=jKnJFAHTFN55EzsusgDce-yux71zVbdSJ1m8utR4EjU,28096
17
17
  exa_py/websets/webhooks/__init__.py,sha256=iTPBCxFd73z4RifLQMX6iRECx_6pwlI5qscLNjMOUHE,77
18
- exa_py/websets/webhooks/client.py,sha256=jNNFzUoWXW9KOswNrZ32LUO1gSbA89XBWyQkyLrUAuE,2664
19
- exa_py/websets/websets_one_file.txt,sha256=u12CY0G5vqA3AzjQnotWfD9f0affhvtU-Tzir51v3aQ,33007
20
- exa_py-1.11.0.dist-info/METADATA,sha256=G46FhO3UNnF2cQj5aQkzsqrBIPhl70yFKE66uZEQ2dw,3565
21
- exa_py-1.11.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
22
- exa_py-1.11.0.dist-info/RECORD,,
18
+ exa_py/websets/webhooks/client.py,sha256=zsIRMTeJU65yj-zo7Zz-gG02Prtzgcx6utGFSoY4HQQ,4222
19
+ exa_py-1.12.1.dist-info/METADATA,sha256=Pk_iVbhNBMLmO5e5D_rA0rj8mLlCP9TrbwaqXKlbX_c,3565
20
+ exa_py-1.12.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
21
+ exa_py-1.12.1.dist-info/RECORD,,