seenwa 0.1.0__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.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .pytest_cache/
4
+ .venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
seenwa-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Seen
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.
seenwa-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.5
2
+ Name: seenwa
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Seen WhatsApp Business API.
5
+ Project-URL: Homepage, https://seen.com
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.8
9
+ Requires-Dist: requests>=2.31.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # seenwa
13
+
14
+ Python SDK for the Seen WhatsApp Business API.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install seenwa
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from seenwa import SeenClient
26
+
27
+ client = SeenClient(api_key="YOUR_API_KEY")
28
+ ```
seenwa-0.1.0/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # seenwa
2
+
3
+ Python SDK for the Seen WhatsApp Business API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install seenwa
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from seenwa import SeenClient
15
+
16
+ client = SeenClient(api_key="YOUR_API_KEY")
17
+ ```
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "seenwa"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the Seen WhatsApp Business API."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ dependencies = [
13
+ "requests>=2.31.0",
14
+ ]
15
+
16
+ [project.urls]
17
+ Homepage = "https://seen.com"
18
+
19
+ [tool.hatch.build.targets.wheel]
20
+ packages = ["src/seenwa"]
21
+
22
+ [tool.pytest.ini_options]
23
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ from .client import SeenClient
2
+ from .errors import SeenAPIError
3
+
4
+ __all__ = ["SeenClient", "SeenAPIError"]
@@ -0,0 +1,36 @@
1
+ from typing import Any, Optional
2
+
3
+ import requests
4
+
5
+ from .errors import SeenAPIError
6
+
7
+ DEFAULT_BASE_URL = "https://api.seen.com/api/v1"
8
+
9
+
10
+ class SeenClient:
11
+ def __init__(self, api_key: str, base_url: str = DEFAULT_BASE_URL):
12
+ self.api_key = api_key
13
+ self.base_url = base_url.rstrip("/")
14
+ self._session = requests.Session()
15
+
16
+ def request(self, method: str, path: str, json: Optional[dict] = None) -> Any:
17
+ response = self._session.request(
18
+ method,
19
+ f"{self.base_url}{path}",
20
+ json=json,
21
+ headers={"x-api-key": self.api_key},
22
+ )
23
+
24
+ try:
25
+ payload = response.json()
26
+ except ValueError:
27
+ payload = None
28
+
29
+ if not response.ok or payload is None:
30
+ raise SeenAPIError(
31
+ f"Seen API request failed with status {response.status_code}",
32
+ response.status_code,
33
+ payload,
34
+ )
35
+
36
+ return payload["data"]
@@ -0,0 +1,5 @@
1
+ class SeenAPIError(Exception):
2
+ def __init__(self, message: str, status: int, body=None):
3
+ super().__init__(message)
4
+ self.status = status
5
+ self.body = body
File without changes
@@ -0,0 +1,6 @@
1
+ from seenwa import SeenClient
2
+
3
+
4
+ def test_constructs_with_default_base_url():
5
+ client = SeenClient(api_key="test-key")
6
+ assert client.base_url == "https://api.seen.com/api/v1"