You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-75Lines changed: 20 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ A lightweight and robust Python SDK for interacting with the Wasender API ([http
15
15
16
16
-**Pydantic Models:** Leverages Pydantic for robust request/response validation and serialization, especially for the generic `send()` method and webhook event parsing.
17
17
-**Message Sending:**
18
-
- Simplified helper methods (e.g., `client.send_text(to=\"...\", text_body=\"...\")`, `client.send_image(to=\"...\", url=\"...\", caption=\"...\")`) that accept direct parameters for common message types.
18
+
- Simplified helper methods (e.g., `client.send_text(to="...", text_body="...")`, `client.send_image(to="...", url="...", caption="...")`) that accept direct parameters for common message types.
19
19
- Generic `client.send(payload: BaseMessage)` method for advanced use cases or less common message types, accepting a Pydantic model.
20
20
- Support for text, image, video, document, audio, sticker, contact card, and location messages.
21
21
-**Contact Management:** List, retrieve details, get profile pictures, block, and unblock contacts.
@@ -26,7 +26,7 @@ A lightweight and robust Python SDK for interacting with the Wasender API ([http
26
26
-**Error Handling:** Comprehensive `WasenderAPIError` class with detailed error information.
27
27
-**Rate Limiting:** Access to rate limit information on API responses.
28
28
-**Retry Mechanism:** Optional automatic retries for rate-limited requests (HTTP 429) via `RetryConfig`.
29
-
-**Customizable HTTP Client:** Allows providing a custom `fetch_implementation` (compatible with `requests.request` or an async equivalent) for specialized HTTP handling or testing.
29
+
-**Customizable HTTP Client:** Allows providing a custom `httpx.AsyncClient` instance for the asynchronous client.
For advanced scenarios, such as custom logging, request/response modification, or integration with specific HTTP libraries, you can provide your own HTTP fetch implementation.
734
-
735
-
**Synchronous Client:**
736
-
737
-
When initializing `WasenderSyncClient` (or using `create_sync_wasender`), the underlying HTTP calls are made using the `requests` library by default. If you need to customize this, you would typically do so by configuring the global`requests` behavior or by wrapping calls to the SDKif fine-grained control per request is needed (though the SDK doesn't directly expose a hook for a custom *sync* fetch function in its constructor anymore after recent refactoring focused on `httpx` for async and standard `requests` for sync internally).
738
-
739
-
**Asynchronous Client:**
740
-
741
-
The `WasenderAsyncClient` (and`create_async_wasender` factory) uses `httpx.AsyncClient` internally. You can pass your pre-configured `httpx.AsyncClient` instance during initialization:
742
-
743
-
```python
744
-
import httpx
745
-
from wasenderapi import create_async_wasender
746
-
from wasenderapi.models import RetryConfig # Ensure RetryConfig is imported if used
747
-
748
-
# Example: Configure a custom httpx.AsyncClient with a timeout
# e.g., status = await async_client_custom.get_session_status("your_session_id")
765
-
print("Using async client with custom httpx client")
766
-
767
-
# await use_custom_client()
768
-
```
769
-
770
715
### Configuring Retries
771
716
772
717
The SDK supports automatic retries, primarily for handling HTTP429 (Too Many Requests) errors. This is configured via the `RetryConfig`object passed to `retry_options` during client initialization.
0 commit comments