aircall-api 1.1.0__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.
@@ -0,0 +1,429 @@
1
+ Metadata-Version: 2.4
2
+ Name: aircall-api
3
+ Version: 1.1.0
4
+ Summary: Python API Built to connect with aircall.io API Endpoints
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/Riprock/aircall-api
7
+ Project-URL: Bug Tracker, https://github.com/Riprock/aircall-api/issues
8
+ Project-URL: Documentation, https://github.com/Riprock/aircall-api#readme
9
+ Project-URL: Repository, https://github.com/Riprock/aircall-api
10
+ Keywords: aircall,api,telephony,voip,phone,calls,contacts,sms,messaging,client,sdk
11
+ Requires-Python: >=3.13
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pydantic>=2.12.4
15
+ Requires-Dist: requests>=2.32.5
16
+ Dynamic: license-file
17
+
18
+ # Aircall API
19
+
20
+ A Python client library for the [Aircall.io](https://aircall.io) API, providing easy access to Aircall's telephony services.
21
+
22
+ ## Features
23
+
24
+ - Full type hints with Pydantic models
25
+ - Comprehensive API coverage for Aircall endpoints
26
+ - Simple and intuitive interface
27
+ - Built-in authentication handling
28
+ - Custom exceptions for proper error handling
29
+ - Automatic request/response serialization
30
+ - Comprehensive logging support for debugging and monitoring
31
+ - Python 3.13+ support
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install aircall-api
37
+ ```
38
+
39
+ Or using `uv`:
40
+
41
+ ```bash
42
+ uv add aircall-api
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from aircall import AircallClient
49
+
50
+ # Initialize the client
51
+ client = AircallClient(
52
+ api_id="your_api_id",
53
+ api_token="your_api_token"
54
+ )
55
+
56
+ # List phone numbers
57
+ numbers = client.number.list()
58
+
59
+ # Get a specific number
60
+ number = client.number.get(12345)
61
+ ```
62
+
63
+ ## Authentication
64
+
65
+ To use this library, you'll need your Aircall API credentials:
66
+
67
+ 1. Log in to your [Aircall Dashboard](https://dashboard.aircall.io)
68
+ 2. Navigate to Settings > Integrations > API Keys
69
+ 3. Create a new API key or use an existing one
70
+ 4. Use the API ID and API Token to initialize the client
71
+
72
+ ```python
73
+ client = AircallClient(
74
+ api_id="YOUR_API_ID",
75
+ api_token="YOUR_API_TOKEN",
76
+ timeout=30, # Optional: request timeout in seconds
77
+ verbose=False # Optional: enable debug logging
78
+ )
79
+ ```
80
+
81
+ ## Available Resources
82
+
83
+ The library provides access to the following Aircall API resources:
84
+
85
+ - **Calls** - List, search, retrieve call details, voicemails, and insights
86
+ - **Contacts** - Manage contact information
87
+ - **Numbers** - Manage phone numbers
88
+ - **Users** - Manage team members
89
+ - **Teams** - Manage teams
90
+ - **Tags** - Organize calls and contacts with tags
91
+ - **Messages** - SMS messaging
92
+ - **Webhooks** - Configure webhook endpoints
93
+ - **Integrations** - Manage third-party integrations
94
+ - **Dialer Campaigns** - Manage dialer campaigns
95
+ - **Companies** - Company information
96
+ - **AI Voice Agents** - AI-powered voice agent management
97
+ - **Conversation Intelligence** - Call analytics and insights
98
+
99
+ ### Usage Examples
100
+
101
+ #### Working with Calls
102
+
103
+ ```python
104
+ # List all calls
105
+ calls = client.call.list(page=1, per_page=20)
106
+
107
+ # Get a specific call
108
+ call = client.call.get(call_id=12345)
109
+
110
+ # Search for calls
111
+ calls = client.call.search(from_date="2024-01-01", to_date="2024-01-31")
112
+ ```
113
+
114
+ #### Working with Contacts
115
+
116
+ ```python
117
+ # List all contacts
118
+ contacts = client.contact.list()
119
+
120
+ # Create a new contact
121
+ contact = client.contact.create(
122
+ first_name="John",
123
+ last_name="Doe",
124
+ phone_numbers=["+1234567890"]
125
+ )
126
+
127
+ # Update a contact
128
+ client.contact.update(contact_id=12345, email="john.doe@example.com")
129
+ ```
130
+
131
+ #### Working with Numbers
132
+
133
+ ```python
134
+ # List all numbers
135
+ numbers = client.number.list()
136
+
137
+ # Get a specific number
138
+ number = client.number.get(number_id=12345)
139
+ ```
140
+
141
+ ## Error Handling
142
+
143
+ The library provides custom exceptions for different error scenarios. All exceptions inherit from `AircallError`:
144
+
145
+ ```python
146
+ from aircall import (
147
+ AircallClient,
148
+ ValidationError,
149
+ AuthenticationError,
150
+ NotFoundError,
151
+ UnprocessableEntityError,
152
+ RateLimitError,
153
+ ServerError,
154
+ AircallConnectionError,
155
+ AircallTimeoutError,
156
+ )
157
+
158
+ client = AircallClient(api_id="your_id", api_token="your_token")
159
+
160
+ try:
161
+ contact = client.contact.get(12345)
162
+ except NotFoundError:
163
+ print("Contact not found")
164
+ except AuthenticationError:
165
+ print("Invalid API credentials")
166
+ except RateLimitError as e:
167
+ print(f"Rate limit exceeded. Retry after {e.retry_after} seconds")
168
+ except ValidationError as e:
169
+ print(f"Invalid request: {e.message}")
170
+ except AircallTimeoutError:
171
+ print("Request timed out")
172
+ except AircallConnectionError:
173
+ print("Failed to connect to Aircall API")
174
+ ```
175
+
176
+ ### Available Exceptions
177
+
178
+ - **`ValidationError`** (400) - Invalid request payload or bad request
179
+ - **`AuthenticationError`** (401, 403) - Invalid API credentials
180
+ - **`NotFoundError`** (404) - Resource not found
181
+ - **`UnprocessableEntityError`** (422) - Server unable to process the request
182
+ - **`RateLimitError`** (429) - Rate limit exceeded (includes `retry_after` attribute)
183
+ - **`ServerError`** (5xx) - Aircall server error
184
+ - **`AircallConnectionError`** - Network connection failed
185
+ - **`AircallTimeoutError`** - Request timed out
186
+
187
+ All exceptions include:
188
+ - `message`: Error description
189
+ - `status_code`: HTTP status code (for API errors)
190
+ - `response_data`: Full error response from the API (if available)
191
+
192
+ ## Logging
193
+
194
+ The Aircall SDK includes comprehensive logging capabilities to help you debug issues, monitor API requests, and track application behavior.
195
+
196
+ ### Quick Start with Logging
197
+
198
+ Enable debug logging with the `verbose` parameter:
199
+
200
+ ```python
201
+ from aircall import AircallClient
202
+
203
+ # Enable verbose logging (sets log level to DEBUG)
204
+ client = AircallClient(
205
+ api_id="your_api_id",
206
+ api_token="your_api_token",
207
+ verbose=True # Enables DEBUG level logging
208
+ )
209
+
210
+ # Now all API requests/responses will be logged
211
+ numbers = client.number.list()
212
+ ```
213
+
214
+ ### Configuring Logging Levels
215
+
216
+ For more control, configure logging manually using Python's standard `logging` module:
217
+
218
+ ```python
219
+ import logging
220
+ from aircall import AircallClient, configure_logging
221
+
222
+ # Configure logging for the entire SDK
223
+ configure_logging(logging.INFO)
224
+
225
+ # Or configure logging for specific components
226
+ logging.getLogger('aircall.client').setLevel(logging.DEBUG)
227
+ logging.getLogger('aircall.resources').setLevel(logging.INFO)
228
+
229
+ client = AircallClient(api_id="your_id", api_token="your_token")
230
+ ```
231
+
232
+ ### Log Levels and What They Capture
233
+
234
+ - **DEBUG**: Detailed request/response information
235
+ - Request method, URL, query parameters, request body
236
+ - Response status codes and timing
237
+ - Example: `Request: GET https://api.aircall.io/v1/numbers?page=1`
238
+
239
+ - **INFO**: High-level operation information
240
+ - Client initialization
241
+ - Critical operations (call transfers, deletions)
242
+ - Example: `Aircall client initialized`
243
+
244
+ - **WARNING**: Important events that may need attention
245
+ - API errors and HTTP error status codes
246
+ - Rate limit warnings
247
+ - Destructive operations (deleting recordings/voicemails)
248
+ - Example: `API error: 404 GET /calls/999 - Not Found (took 0.34s)`
249
+
250
+ - **ERROR**: Failures and exceptions
251
+ - Connection errors
252
+ - Timeout errors
253
+ - Example: `Request timeout: GET /calls - Failed after 30s`
254
+
255
+ ### Advanced Logging Configuration
256
+
257
+ #### Logging to a File
258
+
259
+ ```python
260
+ import logging
261
+ from aircall import AircallClient
262
+
263
+ # Configure file logging
264
+ logging.basicConfig(
265
+ filename='aircall_api.log',
266
+ level=logging.DEBUG,
267
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
268
+ datefmt='%Y-%m-%d %H:%M:%S'
269
+ )
270
+
271
+ client = AircallClient(api_id="your_id", api_token="your_token")
272
+ ```
273
+
274
+ #### Custom Logger Configuration
275
+
276
+ ```python
277
+ import logging
278
+ from aircall import AircallClient
279
+
280
+ # Create custom logger with specific handler
281
+ logger = logging.getLogger('aircall')
282
+ logger.setLevel(logging.INFO)
283
+
284
+ # Add console handler
285
+ handler = logging.StreamHandler()
286
+ handler.setLevel(logging.DEBUG)
287
+
288
+ # Custom formatter
289
+ formatter = logging.Formatter(
290
+ '%(asctime)s [%(name)s] %(levelname)s: %(message)s'
291
+ )
292
+ handler.setFormatter(formatter)
293
+ logger.addHandler(handler)
294
+
295
+ client = AircallClient(api_id="your_id", api_token="your_token")
296
+ ```
297
+
298
+ #### Filtering Logs by Resource
299
+
300
+ Each resource has its own logger namespace:
301
+
302
+ ```python
303
+ import logging
304
+
305
+ # Only show logs from the call resource
306
+ logging.getLogger('aircall.resources.CallResource').setLevel(logging.DEBUG)
307
+
308
+ # Disable logging for the contact resource
309
+ logging.getLogger('aircall.resources.ContactResource').setLevel(logging.CRITICAL)
310
+ ```
311
+
312
+ ### Example Log Output
313
+
314
+ With `verbose=True` or `DEBUG` level logging enabled:
315
+
316
+ ```
317
+ 2025-11-09 10:30:45 - aircall.client - INFO - Aircall client initialized
318
+ 2025-11-09 10:30:46 - aircall.client - DEBUG - Request: GET https://api.aircall.io/v1/numbers
319
+ 2025-11-09 10:30:46 - aircall.client - DEBUG - Query params: {'page': 1, 'per_page': 20}
320
+ 2025-11-09 10:30:46 - aircall.client - DEBUG - Response: 200 GET https://api.aircall.io/v1/numbers (took 0.23s)
321
+ 2025-11-09 10:30:47 - aircall.resources.CallResource - INFO - Transferring call 12345 to number 67890
322
+ 2025-11-09 10:30:47 - aircall.client - DEBUG - Request: POST https://api.aircall.io/v1/calls/12345/transfers
323
+ 2025-11-09 10:30:47 - aircall.client - DEBUG - Request body: {'number_id': 67890}
324
+ 2025-11-09 10:30:48 - aircall.client - DEBUG - Response: 200 POST https://api.aircall.io/v1/calls/12345/transfers (took 0.45s)
325
+ 2025-11-09 10:30:48 - aircall.resources.CallResource - INFO - Successfully transferred call 12345
326
+ ```
327
+
328
+ ### Best Practices
329
+
330
+ 1. **Production**: Use `INFO` or `WARNING` level to avoid logging sensitive request/response data
331
+ 2. **Development**: Use `DEBUG` level or `verbose=True` for detailed troubleshooting
332
+ 3. **Monitoring**: Use `WARNING` level to track API errors and rate limits
333
+ 4. **File Logging**: Always use file logging in production for audit trails
334
+ 5. **Sensitive Data**: Be cautious about logging request bodies that might contain PII
335
+
336
+ ## Development
337
+
338
+ ### Setup
339
+
340
+ This project uses [uv](https://github.com/astral-sh/uv) for dependency management.
341
+
342
+ ```bash
343
+ # Clone the repository
344
+ git clone https://github.com/yourusername/aircall-api.git
345
+ cd aircall-api
346
+
347
+ # Install dependencies
348
+ uv sync
349
+
350
+ # Activate virtual environment
351
+ source .venv/bin/activate # Linux/Mac
352
+ # or
353
+ .venv\Scripts\activate # Windows
354
+ ```
355
+
356
+ ### Testing
357
+
358
+ ```bash
359
+ # Run tests
360
+ pytest
361
+
362
+ # Run tests with coverage
363
+ pytest --cov=aircall
364
+ ```
365
+
366
+ ### Linting
367
+
368
+ ```bash
369
+ # Run ruff for linting
370
+ ruff check .
371
+
372
+ # Run pylint
373
+ pylint src/aircall
374
+ ```
375
+
376
+ ## Project Structure
377
+
378
+ ```
379
+ aircall-api/
380
+ ├── src/
381
+ │ └── aircall/
382
+ │ ├── __init__.py
383
+ │ ├── client.py # Main API client
384
+ │ ├── exceptions.py # Custom exceptions
385
+ │ ├── models/ # Pydantic models
386
+ │ │ ├── call.py
387
+ │ │ ├── contact.py
388
+ │ │ ├── user.py
389
+ │ │ └── ...
390
+ │ └── resources/ # API resource handlers
391
+ │ ├── base.py
392
+ │ ├── call.py
393
+ │ ├── contact.py
394
+ │ └── ...
395
+ ├── tests/ # Test suite
396
+ ├── pyproject.toml # Project configuration
397
+ └── README.md
398
+ ```
399
+
400
+ ## Requirements
401
+
402
+ - Python >= 3.13
403
+ - requests >= 2.32.5
404
+ - pydantic >= 2.12.4
405
+
406
+ ## Contributing
407
+
408
+ Contributions are welcome! Please feel free to submit a Pull Request.
409
+
410
+ 1. Fork the repository
411
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
412
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
413
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
414
+ 5. Open a Pull Request
415
+
416
+ ## License
417
+
418
+ This project is licensed under the MIT License - see the LICENSE file for details.
419
+
420
+ ## Resources
421
+
422
+ - [Aircall API Documentation](https://developer.aircall.io/)
423
+ - [Aircall Dashboard](https://dashboard.aircall.io)
424
+
425
+ ## Support
426
+
427
+ For issues and questions:
428
+ - Open an issue on [GitHub](https://github.com/yourusername/aircall-api/issues)
429
+ - Check the [Aircall API Documentation](https://developer.aircall.io/)
@@ -0,0 +1,39 @@
1
+ aircall/__init__.py,sha256=Oz9fnQf2vCn-ft1t3QdmyCH5I0fOksuRdHuKJM-ICq4,845
2
+ aircall/client.py,sha256=HtcdhxK9H0c8G3P0nH06wixKsneAvXW9IkcPc6n4oKo,9509
3
+ aircall/exceptions.py,sha256=fqD_IdvYoMmkJxIgZfXGV97F7ZkZ8nLFqxa5fGpNjw4,1465
4
+ aircall/logging_config.py,sha256=Zn9q5nIvY5zXpHAmCKWTjafhT5CdqoRt3zi5cPslViE,2282
5
+ aircall/models/__init__.py,sha256=LvXrwQ7skh1_Ane9H0sLDB6WnOls9UqeK3GWjTzQiMo,2024
6
+ aircall/models/ai_voice_agent.py,sha256=z1BsETcJ1XCObG_X_iLx4ge65oT2mIQbrhPiyz6KPI8,1370
7
+ aircall/models/call.py,sha256=DX5ZQPEbJGTPkdKuKYRuOY7-BAw7MI7YkETt361D71E,3205
8
+ aircall/models/company.py,sha256=pV72WyOKosvMQDgTv-W4fwEEkEaDex37qhUqUhksfjk,324
9
+ aircall/models/contact.py,sha256=fCSyvKPCulXd4kkhc-FT81ECU4JgxV4vduX6N-GcBik,757
10
+ aircall/models/content.py,sha256=FktEBk01L5pQxoAM_1uJAoNmZgc49OHeO1eUXom-XUc,974
11
+ aircall/models/conversation_intelligence.py,sha256=tVdS2HcSzVwY7OwJtk6p0_fuvPbqVh6Y5a4P2EyKJ-I,2042
12
+ aircall/models/dialer_campaign.py,sha256=lu5rY72xAcl_HFL8U3xlOUoW10-QQVHrnx632xw-yVM,510
13
+ aircall/models/integration.py,sha256=tADniPuCMzQunmkqmFxOs-snweL9I5PSJvhObqUKXvA,501
14
+ aircall/models/ivr_option.py,sha256=cKC0QKVKrkpeaEIrIzoBVnCeXwiN0XX7kS-7qF1eGJ4,588
15
+ aircall/models/message.py,sha256=uuOVFTHVrGBpvZY7ahct54YVTwCTTLLZfEvLbv4kTc4,1536
16
+ aircall/models/number.py,sha256=heKFap8H3kboyM_D51rnkeMW5jT-HCkeIC_I2-zBykw,1599
17
+ aircall/models/participant.py,sha256=Yt649j4gAVoIT2kwv3P1QEk3-FZJ5QO7dFPEQOWQ8ZE,1284
18
+ aircall/models/tag.py,sha256=KX3GaZ3JuUnvfmb9nDK9EYrXlNMHAZAJky1Eadn0znQ,433
19
+ aircall/models/team.py,sha256=RYBT9Md5ef3ikDNvFTUAd5wy2OfKMOG2l5XSvY7wsKA,473
20
+ aircall/models/user.py,sha256=9q8XpCpV_C5ar1B7MMVtdO8228a-MbwqgP_ocbtlrpM,1432
21
+ aircall/models/webhook.py,sha256=HgGIH7SDzgG9msiX7QslXkSGRIcmXOFeCnpWCcH0Yws,692
22
+ aircall/resources/__init__.py,sha256=JK32BLMr8_jil7A_zghsSN3oyZO52SUrhO530uw40MU,959
23
+ aircall/resources/base.py,sha256=vXl4OIo5yziH0-HnejQWLA7Slu_vWCn37jcW4XBavgo,2134
24
+ aircall/resources/call.py,sha256=BT6eSEKkCRb6AxoDBoBrQ2OSeBifQRRjS9c7g2tOtgA,7387
25
+ aircall/resources/company.py,sha256=VcGaaPTvHTKn0TTXMrJKFVOMj6RwqWDK5H9wPQIWCjs,861
26
+ aircall/resources/contact.py,sha256=1KARkNoNjU4smiFtiHqJ6c9axrY41x3N_aehZRo1By8,5830
27
+ aircall/resources/dialer_campaign.py,sha256=bCjNdFTdFyZBHOyHZOn3i9adldowhtN0oJkVP4YS6Ec,2796
28
+ aircall/resources/integration.py,sha256=Y2iwsVhwNi-kpL_5ydxuEooGzpmgvQLGpobQ2iWQI5A,1539
29
+ aircall/resources/message.py,sha256=QxdNMhp0aO47f4cdcgUH8RDW4Oh3PA-_NgkT8Q0AN30,2466
30
+ aircall/resources/number.py,sha256=fmFJYQU-bGUOOB6Gitsn9BLYGoHaac6kua2PToqMrAw,2942
31
+ aircall/resources/tag.py,sha256=7Hex5mawD2Fbzb5DFIuPL1eeImyp3ntIXWyyEP-B27U,2311
32
+ aircall/resources/team.py,sha256=2sbwDXQoshpEV0pxekuPxfVeKCOb2AnddDu7na-pYTI,2472
33
+ aircall/resources/user.py,sha256=MTSQpWu1Q1L0tqZnJHUmcxa7si0zge0Gdp3lIf93wPQ,3516
34
+ aircall/resources/webhook.py,sha256=qmnSARKrTAscXCcilXvnuUXHIQTJ84B-xUH28oSTDIA,2558
35
+ aircall_api-1.1.0.dist-info/licenses/LICENSE,sha256=yHVAt5xlUOKAcF2KudKdFcKG5hhBIx8zSXBhTiwZZBY,1060
36
+ aircall_api-1.1.0.dist-info/METADATA,sha256=2ha1dkedP348PiiHxxf3lKZ1BhlBvcmJkbYW9SJvPyI,11840
37
+ aircall_api-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ aircall_api-1.1.0.dist-info/top_level.txt,sha256=9amy_MuKw60STPvDec2U0pjNugPC1JrP1G_8Ib-emLM,8
39
+ aircall_api-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Evan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ aircall