athena-intelligence 0.1.35__tar.gz → 0.1.37__tar.gz

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.
Files changed (48) hide show
  1. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/__init__.py +4 -1
  4. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/base_client.py +3 -0
  5. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/client_wrapper.py +1 -1
  6. athena_intelligence-0.1.37/src/athena/search/client.py +298 -0
  7. athena_intelligence-0.1.37/src/athena/snippet/__init__.py +2 -0
  8. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/__init__.py +2 -0
  9. athena_intelligence-0.1.37/src/athena/types/url_result.py +28 -0
  10. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/README.md +0 -0
  11. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/client.py +0 -0
  12. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/__init__.py +0 -0
  13. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/api_error.py +0 -0
  14. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/datetime_utils.py +0 -0
  15. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/file.py +0 -0
  16. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/http_client.py +0 -0
  17. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/jsonable_encoder.py +0 -0
  18. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/remove_none_from_dict.py +0 -0
  19. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/core/request_options.py +0 -0
  20. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/dataset/__init__.py +0 -0
  21. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/dataset/client.py +0 -0
  22. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/environment.py +0 -0
  23. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/errors/__init__.py +0 -0
  24. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/errors/unprocessable_entity_error.py +0 -0
  25. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/message/__init__.py +0 -0
  26. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/message/client.py +0 -0
  27. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/polling_message_client.py +0 -0
  28. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/py.typed +0 -0
  29. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/query/__init__.py +0 -0
  30. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/query/client.py +0 -0
  31. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/report/__init__.py +0 -0
  32. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/report/client.py +0 -0
  33. {athena_intelligence-0.1.35/src/athena/snippet → athena_intelligence-0.1.37/src/athena/search}/__init__.py +0 -0
  34. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/snippet/client.py +0 -0
  35. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/dataset.py +0 -0
  36. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/get_datasets_response.py +0 -0
  37. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/get_snippets_response.py +0 -0
  38. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/http_validation_error.py +0 -0
  39. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/message_out.py +0 -0
  40. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/message_out_dto.py +0 -0
  41. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/model.py +0 -0
  42. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/report.py +0 -0
  43. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/snippet.py +0 -0
  44. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/sql_results.py +0 -0
  45. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/status_enum.py +0 -0
  46. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/tools.py +0 -0
  47. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/validation_error.py +0 -0
  48. {athena_intelligence-0.1.35 → athena_intelligence-0.1.37}/src/athena/types/validation_error_loc_item.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.35
3
+ Version: 0.1.37
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.35"
3
+ version = "0.1.37"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -13,11 +13,12 @@ from .types import (
13
13
  SqlResults,
14
14
  StatusEnum,
15
15
  Tools,
16
+ UrlResult,
16
17
  ValidationError,
17
18
  ValidationErrorLocItem,
18
19
  )
19
20
  from .errors import UnprocessableEntityError
20
- from . import dataset, message, query, report, snippet
21
+ from . import dataset, message, query, report, search, snippet
21
22
  from .environment import AthenaEnvironment
22
23
 
23
24
  __all__ = [
@@ -35,11 +36,13 @@ __all__ = [
35
36
  "StatusEnum",
36
37
  "Tools",
37
38
  "UnprocessableEntityError",
39
+ "UrlResult",
38
40
  "ValidationError",
39
41
  "ValidationErrorLocItem",
40
42
  "dataset",
41
43
  "message",
42
44
  "query",
43
45
  "report",
46
+ "search",
44
47
  "snippet",
45
48
  ]
@@ -10,6 +10,7 @@ from .environment import AthenaEnvironment
10
10
  from .message.client import AsyncMessageClient, MessageClient
11
11
  from .query.client import AsyncQueryClient, QueryClient
12
12
  from .report.client import AsyncReportClient, ReportClient
13
+ from .search.client import AsyncSearchClient, SearchClient
13
14
  from .snippet.client import AsyncSnippetClient, SnippetClient
14
15
 
15
16
 
@@ -56,6 +57,7 @@ class BaseAthena:
56
57
  self.snippet = SnippetClient(client_wrapper=self._client_wrapper)
57
58
  self.report = ReportClient(client_wrapper=self._client_wrapper)
58
59
  self.query = QueryClient(client_wrapper=self._client_wrapper)
60
+ self.search = SearchClient(client_wrapper=self._client_wrapper)
59
61
 
60
62
 
61
63
  class AsyncBaseAthena:
@@ -101,6 +103,7 @@ class AsyncBaseAthena:
101
103
  self.snippet = AsyncSnippetClient(client_wrapper=self._client_wrapper)
102
104
  self.report = AsyncReportClient(client_wrapper=self._client_wrapper)
103
105
  self.query = AsyncQueryClient(client_wrapper=self._client_wrapper)
106
+ self.search = AsyncSearchClient(client_wrapper=self._client_wrapper)
104
107
 
105
108
 
106
109
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
@@ -16,7 +16,7 @@ class BaseClientWrapper:
16
16
  headers: typing.Dict[str, str] = {
17
17
  "X-Fern-Language": "Python",
18
18
  "X-Fern-SDK-Name": "athena-intelligence",
19
- "X-Fern-SDK-Version": "0.1.35",
19
+ "X-Fern-SDK-Version": "0.1.37",
20
20
  }
21
21
  headers["X-API-KEY"] = self.api_key
22
22
  return headers
@@ -0,0 +1,298 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ import urllib.parse
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.remove_none_from_dict import remove_none_from_dict
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.http_validation_error import HttpValidationError
14
+ from ..types.url_result import UrlResult
15
+
16
+ try:
17
+ import pydantic.v1 as pydantic # type: ignore
18
+ except ImportError:
19
+ import pydantic # type: ignore
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class SearchClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def get_urls(
30
+ self,
31
+ *,
32
+ query: str,
33
+ num_urls: int,
34
+ tbs: str,
35
+ country_code: typing.Optional[str] = OMIT,
36
+ country_restrict: typing.Optional[str] = OMIT,
37
+ site: typing.Optional[str] = OMIT,
38
+ request_options: typing.Optional[RequestOptions] = None,
39
+ ) -> UrlResult:
40
+ """
41
+ Parameters:
42
+ - query: str.
43
+
44
+ - num_urls: int.
45
+
46
+ - tbs: str.
47
+
48
+ - country_code: typing.Optional[str].
49
+
50
+ - country_restrict: typing.Optional[str].
51
+
52
+ - site: typing.Optional[str].
53
+
54
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
55
+ ---
56
+ from athena.client import Athena
57
+
58
+ client = Athena(
59
+ api_key="YOUR_API_KEY",
60
+ )
61
+ client.search.get_urls(
62
+ query="query",
63
+ num_urls=1,
64
+ tbs="tbs",
65
+ )
66
+ """
67
+ _request: typing.Dict[str, typing.Any] = {"query": query, "num_urls": num_urls, "tbs": tbs}
68
+ if country_code is not OMIT:
69
+ _request["country_code"] = country_code
70
+ if country_restrict is not OMIT:
71
+ _request["country_restrict"] = country_restrict
72
+ if site is not OMIT:
73
+ _request["site"] = site
74
+ _response = self._client_wrapper.httpx_client.request(
75
+ "POST",
76
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-urls"),
77
+ params=jsonable_encoder(
78
+ request_options.get("additional_query_parameters") if request_options is not None else None
79
+ ),
80
+ json=jsonable_encoder(_request)
81
+ if request_options is None or request_options.get("additional_body_parameters") is None
82
+ else {
83
+ **jsonable_encoder(_request),
84
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
85
+ },
86
+ headers=jsonable_encoder(
87
+ remove_none_from_dict(
88
+ {
89
+ **self._client_wrapper.get_headers(),
90
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
91
+ }
92
+ )
93
+ ),
94
+ timeout=request_options.get("timeout_in_seconds")
95
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
96
+ else 60,
97
+ retries=0,
98
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
99
+ )
100
+ if 200 <= _response.status_code < 300:
101
+ return pydantic.parse_obj_as(UrlResult, _response.json()) # type: ignore
102
+ if _response.status_code == 422:
103
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
104
+ try:
105
+ _response_json = _response.json()
106
+ except JSONDecodeError:
107
+ raise ApiError(status_code=_response.status_code, body=_response.text)
108
+ raise ApiError(status_code=_response.status_code, body=_response_json)
109
+
110
+ def get_markdown(self, *, url: str, request_options: typing.Optional[RequestOptions] = None) -> UrlResult:
111
+ """
112
+ Parameters:
113
+ - url: str.
114
+
115
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
116
+ ---
117
+ from athena.client import Athena
118
+
119
+ client = Athena(
120
+ api_key="YOUR_API_KEY",
121
+ )
122
+ client.search.get_markdown(
123
+ url="url",
124
+ )
125
+ """
126
+ _response = self._client_wrapper.httpx_client.request(
127
+ "POST",
128
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-markdown"),
129
+ params=jsonable_encoder(
130
+ request_options.get("additional_query_parameters") if request_options is not None else None
131
+ ),
132
+ json=jsonable_encoder({"url": url})
133
+ if request_options is None or request_options.get("additional_body_parameters") is None
134
+ else {
135
+ **jsonable_encoder({"url": url}),
136
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
137
+ },
138
+ headers=jsonable_encoder(
139
+ remove_none_from_dict(
140
+ {
141
+ **self._client_wrapper.get_headers(),
142
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
143
+ }
144
+ )
145
+ ),
146
+ timeout=request_options.get("timeout_in_seconds")
147
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
148
+ else 60,
149
+ retries=0,
150
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
151
+ )
152
+ if 200 <= _response.status_code < 300:
153
+ return pydantic.parse_obj_as(UrlResult, _response.json()) # type: ignore
154
+ if _response.status_code == 422:
155
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
156
+ try:
157
+ _response_json = _response.json()
158
+ except JSONDecodeError:
159
+ raise ApiError(status_code=_response.status_code, body=_response.text)
160
+ raise ApiError(status_code=_response.status_code, body=_response_json)
161
+
162
+
163
+ class AsyncSearchClient:
164
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
165
+ self._client_wrapper = client_wrapper
166
+
167
+ async def get_urls(
168
+ self,
169
+ *,
170
+ query: str,
171
+ num_urls: int,
172
+ tbs: str,
173
+ country_code: typing.Optional[str] = OMIT,
174
+ country_restrict: typing.Optional[str] = OMIT,
175
+ site: typing.Optional[str] = OMIT,
176
+ request_options: typing.Optional[RequestOptions] = None,
177
+ ) -> UrlResult:
178
+ """
179
+ Parameters:
180
+ - query: str.
181
+
182
+ - num_urls: int.
183
+
184
+ - tbs: str.
185
+
186
+ - country_code: typing.Optional[str].
187
+
188
+ - country_restrict: typing.Optional[str].
189
+
190
+ - site: typing.Optional[str].
191
+
192
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
193
+ ---
194
+ from athena.client import AsyncAthena
195
+
196
+ client = AsyncAthena(
197
+ api_key="YOUR_API_KEY",
198
+ )
199
+ await client.search.get_urls(
200
+ query="query",
201
+ num_urls=1,
202
+ tbs="tbs",
203
+ )
204
+ """
205
+ _request: typing.Dict[str, typing.Any] = {"query": query, "num_urls": num_urls, "tbs": tbs}
206
+ if country_code is not OMIT:
207
+ _request["country_code"] = country_code
208
+ if country_restrict is not OMIT:
209
+ _request["country_restrict"] = country_restrict
210
+ if site is not OMIT:
211
+ _request["site"] = site
212
+ _response = await self._client_wrapper.httpx_client.request(
213
+ "POST",
214
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-urls"),
215
+ params=jsonable_encoder(
216
+ request_options.get("additional_query_parameters") if request_options is not None else None
217
+ ),
218
+ json=jsonable_encoder(_request)
219
+ if request_options is None or request_options.get("additional_body_parameters") is None
220
+ else {
221
+ **jsonable_encoder(_request),
222
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
223
+ },
224
+ headers=jsonable_encoder(
225
+ remove_none_from_dict(
226
+ {
227
+ **self._client_wrapper.get_headers(),
228
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
229
+ }
230
+ )
231
+ ),
232
+ timeout=request_options.get("timeout_in_seconds")
233
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
234
+ else 60,
235
+ retries=0,
236
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
237
+ )
238
+ if 200 <= _response.status_code < 300:
239
+ return pydantic.parse_obj_as(UrlResult, _response.json()) # type: ignore
240
+ if _response.status_code == 422:
241
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
242
+ try:
243
+ _response_json = _response.json()
244
+ except JSONDecodeError:
245
+ raise ApiError(status_code=_response.status_code, body=_response.text)
246
+ raise ApiError(status_code=_response.status_code, body=_response_json)
247
+
248
+ async def get_markdown(self, *, url: str, request_options: typing.Optional[RequestOptions] = None) -> UrlResult:
249
+ """
250
+ Parameters:
251
+ - url: str.
252
+
253
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
254
+ ---
255
+ from athena.client import AsyncAthena
256
+
257
+ client = AsyncAthena(
258
+ api_key="YOUR_API_KEY",
259
+ )
260
+ await client.search.get_markdown(
261
+ url="url",
262
+ )
263
+ """
264
+ _response = await self._client_wrapper.httpx_client.request(
265
+ "POST",
266
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/get-markdown"),
267
+ params=jsonable_encoder(
268
+ request_options.get("additional_query_parameters") if request_options is not None else None
269
+ ),
270
+ json=jsonable_encoder({"url": url})
271
+ if request_options is None or request_options.get("additional_body_parameters") is None
272
+ else {
273
+ **jsonable_encoder({"url": url}),
274
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
275
+ },
276
+ headers=jsonable_encoder(
277
+ remove_none_from_dict(
278
+ {
279
+ **self._client_wrapper.get_headers(),
280
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
281
+ }
282
+ )
283
+ ),
284
+ timeout=request_options.get("timeout_in_seconds")
285
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
286
+ else 60,
287
+ retries=0,
288
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
289
+ )
290
+ if 200 <= _response.status_code < 300:
291
+ return pydantic.parse_obj_as(UrlResult, _response.json()) # type: ignore
292
+ if _response.status_code == 422:
293
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
294
+ try:
295
+ _response_json = _response.json()
296
+ except JSONDecodeError:
297
+ raise ApiError(status_code=_response.status_code, body=_response.text)
298
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -12,6 +12,7 @@ from .snippet import Snippet
12
12
  from .sql_results import SqlResults
13
13
  from .status_enum import StatusEnum
14
14
  from .tools import Tools
15
+ from .url_result import UrlResult
15
16
  from .validation_error import ValidationError
16
17
  from .validation_error_loc_item import ValidationErrorLocItem
17
18
 
@@ -28,6 +29,7 @@ __all__ = [
28
29
  "SqlResults",
29
30
  "StatusEnum",
30
31
  "Tools",
32
+ "UrlResult",
31
33
  "ValidationError",
32
34
  "ValidationErrorLocItem",
33
35
  ]
@@ -0,0 +1,28 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.datetime_utils import serialize_datetime
7
+
8
+ try:
9
+ import pydantic.v1 as pydantic # type: ignore
10
+ except ImportError:
11
+ import pydantic # type: ignore
12
+
13
+
14
+ class UrlResult(pydantic.BaseModel):
15
+ result: typing.Dict[str, typing.Any]
16
+
17
+ def json(self, **kwargs: typing.Any) -> str:
18
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
19
+ return super().json(**kwargs_with_defaults)
20
+
21
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
22
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
23
+ return super().dict(**kwargs_with_defaults)
24
+
25
+ class Config:
26
+ frozen = True
27
+ smart_union = True
28
+ json_encoders = {dt.datetime: serialize_datetime}