fathom-python 0.0.23__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.
Files changed (47) hide show
  1. fathom/__init__.py +57 -0
  2. fathom/base_client.py +453 -0
  3. fathom/client.py +25 -0
  4. fathom/core/__init__.py +52 -0
  5. fathom/core/api_error.py +23 -0
  6. fathom/core/client_wrapper.py +76 -0
  7. fathom/core/datetime_utils.py +28 -0
  8. fathom/core/file.py +67 -0
  9. fathom/core/force_multipart.py +16 -0
  10. fathom/core/http_client.py +543 -0
  11. fathom/core/http_response.py +55 -0
  12. fathom/core/jsonable_encoder.py +100 -0
  13. fathom/core/pydantic_utilities.py +255 -0
  14. fathom/core/query_encoder.py +58 -0
  15. fathom/core/remove_none_from_dict.py +11 -0
  16. fathom/core/request_options.py +35 -0
  17. fathom/core/serialization.py +276 -0
  18. fathom/environment.py +7 -0
  19. fathom/errors/__init__.py +8 -0
  20. fathom/errors/bad_request_error.py +10 -0
  21. fathom/errors/unauthorized_error.py +10 -0
  22. fathom/py.typed +0 -0
  23. fathom/raw_base_client.py +512 -0
  24. fathom/types/__init__.py +45 -0
  25. fathom/types/action_item.py +29 -0
  26. fathom/types/assignee.py +21 -0
  27. fathom/types/crm_company_match.py +20 -0
  28. fathom/types/crm_contact_match.py +21 -0
  29. fathom/types/crm_deal_match.py +21 -0
  30. fathom/types/crm_matches.py +30 -0
  31. fathom/types/fathom_user.py +21 -0
  32. fathom/types/invitee.py +22 -0
  33. fathom/types/list_meetings_request_meeting_type.py +5 -0
  34. fathom/types/meeting.py +51 -0
  35. fathom/types/meeting_list_response.py +22 -0
  36. fathom/types/meeting_meeting_type.py +5 -0
  37. fathom/types/meeting_summary.py +20 -0
  38. fathom/types/team.py +21 -0
  39. fathom/types/team_list_response.py +22 -0
  40. fathom/types/team_member.py +22 -0
  41. fathom/types/team_member_list_response.py +22 -0
  42. fathom/types/transcript_item.py +25 -0
  43. fathom/types/transcript_item_speaker.py +20 -0
  44. fathom/version.py +3 -0
  45. fathom_python-0.0.23.dist-info/METADATA +151 -0
  46. fathom_python-0.0.23.dist-info/RECORD +47 -0
  47. fathom_python-0.0.23.dist-info/WHEEL +4 -0
fathom/__init__.py ADDED
@@ -0,0 +1,57 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ ActionItem,
7
+ Assignee,
8
+ CrmCompanyMatch,
9
+ CrmContactMatch,
10
+ CrmDealMatch,
11
+ CrmMatches,
12
+ FathomUser,
13
+ Invitee,
14
+ ListMeetingsRequestMeetingType,
15
+ Meeting,
16
+ MeetingListResponse,
17
+ MeetingMeetingType,
18
+ MeetingSummary,
19
+ Team,
20
+ TeamListResponse,
21
+ TeamMember,
22
+ TeamMemberListResponse,
23
+ TranscriptItem,
24
+ TranscriptItemSpeaker,
25
+ )
26
+ from .errors import BadRequestError, UnauthorizedError
27
+ from .client import AsyncFathomApi, FathomApi
28
+ from .environment import ClientEnvironment
29
+ from .version import __version__
30
+
31
+ __all__ = [
32
+ "ActionItem",
33
+ "Assignee",
34
+ "AsyncFathomApi",
35
+ "BadRequestError",
36
+ "FathomApi",
37
+ "ClientEnvironment",
38
+ "CrmCompanyMatch",
39
+ "CrmContactMatch",
40
+ "CrmDealMatch",
41
+ "CrmMatches",
42
+ "FathomUser",
43
+ "Invitee",
44
+ "ListMeetingsRequestMeetingType",
45
+ "Meeting",
46
+ "MeetingListResponse",
47
+ "MeetingMeetingType",
48
+ "MeetingSummary",
49
+ "Team",
50
+ "TeamListResponse",
51
+ "TeamMember",
52
+ "TeamMemberListResponse",
53
+ "TranscriptItem",
54
+ "TranscriptItemSpeaker",
55
+ "UnauthorizedError",
56
+ "__version__",
57
+ ]
fathom/base_client.py ADDED
@@ -0,0 +1,453 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import os
4
+ import typing
5
+
6
+ import httpx
7
+ from .core.api_error import ApiError
8
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from .core.request_options import RequestOptions
10
+ from .environment import ClientEnvironment
11
+ from .raw_base_client import AsyncRawBaseClient, RawBaseClient
12
+ from .types.list_meetings_request_meeting_type import ListMeetingsRequestMeetingType
13
+ from .types.meeting_list_response import MeetingListResponse
14
+ from .types.team_list_response import TeamListResponse
15
+ from .types.team_member_list_response import TeamMemberListResponse
16
+
17
+
18
+ class BaseClient:
19
+ """
20
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
21
+
22
+ Parameters
23
+ ----------
24
+ base_url : typing.Optional[str]
25
+ The base url to use for requests from the client.
26
+
27
+ environment : ClientEnvironment
28
+ The environment to use for requests from the client. from .environment import ClientEnvironment
29
+
30
+ Defaults to ClientEnvironment.DEFAULT
31
+
32
+
33
+
34
+ api_key : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
35
+ timeout : typing.Optional[float]
36
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
37
+
38
+ follow_redirects : typing.Optional[bool]
39
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
40
+
41
+ httpx_client : typing.Optional[httpx.Client]
42
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
43
+
44
+ Examples
45
+ --------
46
+ from fathom import Client
47
+ client = Client(api_key="YOUR_API_KEY", )
48
+ """
49
+
50
+ def __init__(
51
+ self,
52
+ *,
53
+ base_url: typing.Optional[str] = None,
54
+ environment: ClientEnvironment = ClientEnvironment.DEFAULT,
55
+ api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("FATHOM_API_KEY"),
56
+ timeout: typing.Optional[float] = None,
57
+ follow_redirects: typing.Optional[bool] = True,
58
+ httpx_client: typing.Optional[httpx.Client] = None,
59
+ ):
60
+ _defaulted_timeout = (
61
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
62
+ )
63
+ if api_key is None:
64
+ raise ApiError(
65
+ body="The client must be instantiated be either passing in api_key or setting FATHOM_API_KEY"
66
+ )
67
+ self._client_wrapper = SyncClientWrapper(
68
+ base_url=_get_base_url(base_url=base_url, environment=environment),
69
+ api_key=api_key,
70
+ httpx_client=httpx_client
71
+ if httpx_client is not None
72
+ else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
73
+ if follow_redirects is not None
74
+ else httpx.Client(timeout=_defaulted_timeout),
75
+ timeout=_defaulted_timeout,
76
+ )
77
+ self._raw_client = RawBaseClient(client_wrapper=self._client_wrapper)
78
+
79
+ @property
80
+ def with_raw_response(self) -> RawBaseClient:
81
+ """
82
+ Retrieves a raw implementation of this client that returns raw responses.
83
+
84
+ Returns
85
+ -------
86
+ RawBaseClient
87
+ """
88
+ return self._raw_client
89
+
90
+ def list_meetings(
91
+ self,
92
+ *,
93
+ recorded_by: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
94
+ teams: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
95
+ calendar_invitees: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
96
+ created_after: typing.Optional[str] = None,
97
+ meeting_type: typing.Optional[ListMeetingsRequestMeetingType] = None,
98
+ include_transcript: typing.Optional[bool] = None,
99
+ cursor: typing.Optional[str] = None,
100
+ request_options: typing.Optional[RequestOptions] = None,
101
+ ) -> MeetingListResponse:
102
+ """
103
+ Parameters
104
+ ----------
105
+ recorded_by : typing.Optional[typing.Union[str, typing.Sequence[str]]]
106
+ Email addresses of meeting owners.
107
+
108
+ Pass the parameter once per value, e.g.
109
+ `recorded_by[]=ceo@acme.com&recorded_by[]=pm@acme.com`.
110
+
111
+ Returns meetings hosted by any of the specified users.
112
+
113
+ teams : typing.Optional[typing.Union[str, typing.Sequence[str]]]
114
+ Team names to filter by.
115
+
116
+ Pass the parameter once per value, e.g.
117
+ `teams[]=Sales&teams[]=Engineering`.
118
+
119
+ Returns meetings that belong to any of the specified teams.
120
+
121
+ calendar_invitees : typing.Optional[typing.Union[str, typing.Sequence[str]]]
122
+ Email addresses of calendar_invitees.
123
+
124
+ Pass the parameter once per value, e.g.
125
+ `calendar_invitees[]=cfo@acme.com&calendar_invitees[]=legal@acme.com`.
126
+
127
+ Returns meetings where any of the given email addresses appear
128
+ in the calendar_invitees list.
129
+
130
+ created_after : typing.Optional[str]
131
+ Filter to meetings with created_at after this timestamp, e.g. `created_after=2025-01-01T00:00:00Z`.
132
+
133
+ meeting_type : typing.Optional[ListMeetingsRequestMeetingType]
134
+ Filter by meeting type.
135
+
136
+ include_transcript : typing.Optional[bool]
137
+ Include the transcript for each meeting.
138
+
139
+ cursor : typing.Optional[str]
140
+ Cursor for pagination.
141
+
142
+ request_options : typing.Optional[RequestOptions]
143
+ Request-specific configuration.
144
+
145
+ Returns
146
+ -------
147
+ MeetingListResponse
148
+ Paginated list of meetings.
149
+
150
+ Examples
151
+ --------
152
+ from fathom import Client
153
+ client = Client(api_key="YOUR_API_KEY", )
154
+ client.list_meetings()
155
+ """
156
+ _response = self._raw_client.list_meetings(
157
+ recorded_by=recorded_by,
158
+ teams=teams,
159
+ calendar_invitees=calendar_invitees,
160
+ created_after=created_after,
161
+ meeting_type=meeting_type,
162
+ include_transcript=include_transcript,
163
+ cursor=cursor,
164
+ request_options=request_options,
165
+ )
166
+ return _response.data
167
+
168
+ def list_teams(
169
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
170
+ ) -> TeamListResponse:
171
+ """
172
+ Parameters
173
+ ----------
174
+ cursor : typing.Optional[str]
175
+ Cursor for pagination.
176
+
177
+ request_options : typing.Optional[RequestOptions]
178
+ Request-specific configuration.
179
+
180
+ Returns
181
+ -------
182
+ TeamListResponse
183
+ Paginated list of teams.
184
+
185
+ Examples
186
+ --------
187
+ from fathom import Client
188
+ client = Client(api_key="YOUR_API_KEY", )
189
+ client.list_teams()
190
+ """
191
+ _response = self._raw_client.list_teams(cursor=cursor, request_options=request_options)
192
+ return _response.data
193
+
194
+ def list_team_members(
195
+ self,
196
+ *,
197
+ team: typing.Optional[str] = None,
198
+ cursor: typing.Optional[str] = None,
199
+ request_options: typing.Optional[RequestOptions] = None,
200
+ ) -> TeamMemberListResponse:
201
+ """
202
+ Parameters
203
+ ----------
204
+ team : typing.Optional[str]
205
+ Team name to filter by.
206
+
207
+ cursor : typing.Optional[str]
208
+ Cursor for pagination.
209
+
210
+ request_options : typing.Optional[RequestOptions]
211
+ Request-specific configuration.
212
+
213
+ Returns
214
+ -------
215
+ TeamMemberListResponse
216
+ Paginated list of team members.
217
+
218
+ Examples
219
+ --------
220
+ from fathom import Client
221
+ client = Client(api_key="YOUR_API_KEY", )
222
+ client.list_team_members()
223
+ """
224
+ _response = self._raw_client.list_team_members(team=team, cursor=cursor, request_options=request_options)
225
+ return _response.data
226
+
227
+
228
+ class AsyncBaseClient:
229
+ """
230
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
231
+
232
+ Parameters
233
+ ----------
234
+ base_url : typing.Optional[str]
235
+ The base url to use for requests from the client.
236
+
237
+ environment : ClientEnvironment
238
+ The environment to use for requests from the client. from .environment import ClientEnvironment
239
+
240
+ Defaults to ClientEnvironment.DEFAULT
241
+
242
+
243
+
244
+ api_key : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
245
+ timeout : typing.Optional[float]
246
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
247
+
248
+ follow_redirects : typing.Optional[bool]
249
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
250
+
251
+ httpx_client : typing.Optional[httpx.AsyncClient]
252
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
253
+
254
+ Examples
255
+ --------
256
+ from fathom import AsyncClient
257
+ client = AsyncClient(api_key="YOUR_API_KEY", )
258
+ """
259
+
260
+ def __init__(
261
+ self,
262
+ *,
263
+ base_url: typing.Optional[str] = None,
264
+ environment: ClientEnvironment = ClientEnvironment.DEFAULT,
265
+ api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("FATHOM_API_KEY"),
266
+ timeout: typing.Optional[float] = None,
267
+ follow_redirects: typing.Optional[bool] = True,
268
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
269
+ ):
270
+ _defaulted_timeout = (
271
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
272
+ )
273
+ if api_key is None:
274
+ raise ApiError(
275
+ body="The client must be instantiated be either passing in api_key or setting FATHOM_API_KEY"
276
+ )
277
+ self._client_wrapper = AsyncClientWrapper(
278
+ base_url=_get_base_url(base_url=base_url, environment=environment),
279
+ api_key=api_key,
280
+ httpx_client=httpx_client
281
+ if httpx_client is not None
282
+ else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
283
+ if follow_redirects is not None
284
+ else httpx.AsyncClient(timeout=_defaulted_timeout),
285
+ timeout=_defaulted_timeout,
286
+ )
287
+ self._raw_client = AsyncRawBaseClient(client_wrapper=self._client_wrapper)
288
+
289
+ @property
290
+ def with_raw_response(self) -> AsyncRawBaseClient:
291
+ """
292
+ Retrieves a raw implementation of this client that returns raw responses.
293
+
294
+ Returns
295
+ -------
296
+ AsyncRawBaseClient
297
+ """
298
+ return self._raw_client
299
+
300
+ async def list_meetings(
301
+ self,
302
+ *,
303
+ recorded_by: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
304
+ teams: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
305
+ calendar_invitees: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
306
+ created_after: typing.Optional[str] = None,
307
+ meeting_type: typing.Optional[ListMeetingsRequestMeetingType] = None,
308
+ include_transcript: typing.Optional[bool] = None,
309
+ cursor: typing.Optional[str] = None,
310
+ request_options: typing.Optional[RequestOptions] = None,
311
+ ) -> MeetingListResponse:
312
+ """
313
+ Parameters
314
+ ----------
315
+ recorded_by : typing.Optional[typing.Union[str, typing.Sequence[str]]]
316
+ Email addresses of meeting owners.
317
+
318
+ Pass the parameter once per value, e.g.
319
+ `recorded_by[]=ceo@acme.com&recorded_by[]=pm@acme.com`.
320
+
321
+ Returns meetings hosted by any of the specified users.
322
+
323
+ teams : typing.Optional[typing.Union[str, typing.Sequence[str]]]
324
+ Team names to filter by.
325
+
326
+ Pass the parameter once per value, e.g.
327
+ `teams[]=Sales&teams[]=Engineering`.
328
+
329
+ Returns meetings that belong to any of the specified teams.
330
+
331
+ calendar_invitees : typing.Optional[typing.Union[str, typing.Sequence[str]]]
332
+ Email addresses of calendar_invitees.
333
+
334
+ Pass the parameter once per value, e.g.
335
+ `calendar_invitees[]=cfo@acme.com&calendar_invitees[]=legal@acme.com`.
336
+
337
+ Returns meetings where any of the given email addresses appear
338
+ in the calendar_invitees list.
339
+
340
+ created_after : typing.Optional[str]
341
+ Filter to meetings with created_at after this timestamp, e.g. `created_after=2025-01-01T00:00:00Z`.
342
+
343
+ meeting_type : typing.Optional[ListMeetingsRequestMeetingType]
344
+ Filter by meeting type.
345
+
346
+ include_transcript : typing.Optional[bool]
347
+ Include the transcript for each meeting.
348
+
349
+ cursor : typing.Optional[str]
350
+ Cursor for pagination.
351
+
352
+ request_options : typing.Optional[RequestOptions]
353
+ Request-specific configuration.
354
+
355
+ Returns
356
+ -------
357
+ MeetingListResponse
358
+ Paginated list of meetings.
359
+
360
+ Examples
361
+ --------
362
+ from fathom import AsyncClient
363
+ import asyncio
364
+ client = AsyncClient(api_key="YOUR_API_KEY", )
365
+ async def main() -> None:
366
+ await client.list_meetings()
367
+ asyncio.run(main())
368
+ """
369
+ _response = await self._raw_client.list_meetings(
370
+ recorded_by=recorded_by,
371
+ teams=teams,
372
+ calendar_invitees=calendar_invitees,
373
+ created_after=created_after,
374
+ meeting_type=meeting_type,
375
+ include_transcript=include_transcript,
376
+ cursor=cursor,
377
+ request_options=request_options,
378
+ )
379
+ return _response.data
380
+
381
+ async def list_teams(
382
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
383
+ ) -> TeamListResponse:
384
+ """
385
+ Parameters
386
+ ----------
387
+ cursor : typing.Optional[str]
388
+ Cursor for pagination.
389
+
390
+ request_options : typing.Optional[RequestOptions]
391
+ Request-specific configuration.
392
+
393
+ Returns
394
+ -------
395
+ TeamListResponse
396
+ Paginated list of teams.
397
+
398
+ Examples
399
+ --------
400
+ from fathom import AsyncClient
401
+ import asyncio
402
+ client = AsyncClient(api_key="YOUR_API_KEY", )
403
+ async def main() -> None:
404
+ await client.list_teams()
405
+ asyncio.run(main())
406
+ """
407
+ _response = await self._raw_client.list_teams(cursor=cursor, request_options=request_options)
408
+ return _response.data
409
+
410
+ async def list_team_members(
411
+ self,
412
+ *,
413
+ team: typing.Optional[str] = None,
414
+ cursor: typing.Optional[str] = None,
415
+ request_options: typing.Optional[RequestOptions] = None,
416
+ ) -> TeamMemberListResponse:
417
+ """
418
+ Parameters
419
+ ----------
420
+ team : typing.Optional[str]
421
+ Team name to filter by.
422
+
423
+ cursor : typing.Optional[str]
424
+ Cursor for pagination.
425
+
426
+ request_options : typing.Optional[RequestOptions]
427
+ Request-specific configuration.
428
+
429
+ Returns
430
+ -------
431
+ TeamMemberListResponse
432
+ Paginated list of team members.
433
+
434
+ Examples
435
+ --------
436
+ from fathom import AsyncClient
437
+ import asyncio
438
+ client = AsyncClient(api_key="YOUR_API_KEY", )
439
+ async def main() -> None:
440
+ await client.list_team_members()
441
+ asyncio.run(main())
442
+ """
443
+ _response = await self._raw_client.list_team_members(team=team, cursor=cursor, request_options=request_options)
444
+ return _response.data
445
+
446
+
447
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: ClientEnvironment) -> str:
448
+ if base_url is not None:
449
+ return base_url
450
+ elif environment is not None:
451
+ return environment.value
452
+ else:
453
+ raise Exception("Please pass in either base_url or environment to construct the client")
fathom/client.py ADDED
@@ -0,0 +1,25 @@
1
+ from .base_client import BaseClient, AsyncBaseClient
2
+ from svix.webhooks import Webhook
3
+
4
+
5
+ class FathomApi(BaseClient):
6
+ def verify_webhook(
7
+ self,
8
+ webhook_secret: str,
9
+ headers: dict,
10
+ payload: str
11
+ ):
12
+ wh = Webhook(webhook_secret)
13
+ return wh.verify(payload, headers)
14
+
15
+
16
+
17
+ class AsyncFathomApi(AsyncBaseClient):
18
+ def verify_webhook(
19
+ self,
20
+ webhook_secret: str,
21
+ headers: dict,
22
+ payload: str
23
+ ):
24
+ wh = Webhook(webhook_secret)
25
+ return wh.verify(payload, headers)
@@ -0,0 +1,52 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .api_error import ApiError
6
+ from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
7
+ from .datetime_utils import serialize_datetime
8
+ from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
9
+ from .http_client import AsyncHttpClient, HttpClient
10
+ from .http_response import AsyncHttpResponse, HttpResponse
11
+ from .jsonable_encoder import jsonable_encoder
12
+ from .pydantic_utilities import (
13
+ IS_PYDANTIC_V2,
14
+ UniversalBaseModel,
15
+ UniversalRootModel,
16
+ parse_obj_as,
17
+ universal_field_validator,
18
+ universal_root_validator,
19
+ update_forward_refs,
20
+ )
21
+ from .query_encoder import encode_query
22
+ from .remove_none_from_dict import remove_none_from_dict
23
+ from .request_options import RequestOptions
24
+ from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
25
+
26
+ __all__ = [
27
+ "ApiError",
28
+ "AsyncClientWrapper",
29
+ "AsyncHttpClient",
30
+ "AsyncHttpResponse",
31
+ "BaseClientWrapper",
32
+ "FieldMetadata",
33
+ "File",
34
+ "HttpClient",
35
+ "HttpResponse",
36
+ "IS_PYDANTIC_V2",
37
+ "RequestOptions",
38
+ "SyncClientWrapper",
39
+ "UniversalBaseModel",
40
+ "UniversalRootModel",
41
+ "convert_and_respect_annotation_metadata",
42
+ "convert_file_dict_to_httpx_tuples",
43
+ "encode_query",
44
+ "jsonable_encoder",
45
+ "parse_obj_as",
46
+ "remove_none_from_dict",
47
+ "serialize_datetime",
48
+ "universal_field_validator",
49
+ "universal_root_validator",
50
+ "update_forward_refs",
51
+ "with_content_type",
52
+ ]
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from typing import Any, Dict, Optional
4
+
5
+
6
+ class ApiError(Exception):
7
+ headers: Optional[Dict[str, str]]
8
+ status_code: Optional[int]
9
+ body: Any
10
+
11
+ def __init__(
12
+ self,
13
+ *,
14
+ headers: Optional[Dict[str, str]] = None,
15
+ status_code: Optional[int] = None,
16
+ body: Any = None,
17
+ ) -> None:
18
+ self.headers = headers
19
+ self.status_code = status_code
20
+ self.body = body
21
+
22
+ def __str__(self) -> str:
23
+ return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"
@@ -0,0 +1,76 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+ from .http_client import AsyncHttpClient, HttpClient
7
+
8
+
9
+ class BaseClientWrapper:
10
+ def __init__(
11
+ self,
12
+ *,
13
+ api_key: typing.Union[str, typing.Callable[[], str]],
14
+ base_url: str,
15
+ timeout: typing.Optional[float] = None,
16
+ ):
17
+ self._api_key = api_key
18
+ self._base_url = base_url
19
+ self._timeout = timeout
20
+
21
+ def get_headers(self) -> typing.Dict[str, str]:
22
+ headers: typing.Dict[str, str] = {
23
+ "X-Fern-Language": "Python",
24
+ "X-Fern-SDK-Name": "fathom-python",
25
+ "X-Fern-SDK-Version": "0.0.23",
26
+ }
27
+ headers["Authorization"] = f"Bearer {self._get_api_key()}"
28
+ return headers
29
+
30
+ def _get_api_key(self) -> str:
31
+ if isinstance(self._api_key, str):
32
+ return self._api_key
33
+ else:
34
+ return self._api_key()
35
+
36
+ def get_base_url(self) -> str:
37
+ return self._base_url
38
+
39
+ def get_timeout(self) -> typing.Optional[float]:
40
+ return self._timeout
41
+
42
+
43
+ class SyncClientWrapper(BaseClientWrapper):
44
+ def __init__(
45
+ self,
46
+ *,
47
+ api_key: typing.Union[str, typing.Callable[[], str]],
48
+ base_url: str,
49
+ timeout: typing.Optional[float] = None,
50
+ httpx_client: httpx.Client,
51
+ ):
52
+ super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
53
+ self.httpx_client = HttpClient(
54
+ httpx_client=httpx_client,
55
+ base_headers=self.get_headers,
56
+ base_timeout=self.get_timeout,
57
+ base_url=self.get_base_url,
58
+ )
59
+
60
+
61
+ class AsyncClientWrapper(BaseClientWrapper):
62
+ def __init__(
63
+ self,
64
+ *,
65
+ api_key: typing.Union[str, typing.Callable[[], str]],
66
+ base_url: str,
67
+ timeout: typing.Optional[float] = None,
68
+ httpx_client: httpx.AsyncClient,
69
+ ):
70
+ super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
71
+ self.httpx_client = AsyncHttpClient(
72
+ httpx_client=httpx_client,
73
+ base_headers=self.get_headers,
74
+ base_timeout=self.get_timeout,
75
+ base_url=self.get_base_url,
76
+ )