fitsms 1.0.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.
fitsms-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: fitsms
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for FitSMS.lk Gateway
5
+ Home-page: https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk
6
+ Author: Danuja Dilanka
7
+ Author-email: dilanka.rajapakshe1@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.1
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
23
+
24
+ # FitSMS Python SDK (v4)
25
+
26
+ The official Python SDK for the [FitSMS.lk](https://fitsms.lk) gateway, maintained by **Global Cloud Media**. Seamlessly integrate SMS capabilities into your Python applications, automation scripts, and AI agents.
27
+
28
+ ## Features
29
+ * **Sri Lankan Number Formatting**: Automatically handles `07...` and `7...` formats to the required `947...` standard.
30
+ * **v4 API Integration**: Fully compatible with the latest FitSMS REST API.
31
+ * **Lightweight**: Minimal dependencies (uses `requests`).
32
+ * **DevOps Ready**: Perfect for VPS monitoring and alert scripts.
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ ### From Source (Local Development)
39
+ ```bash
40
+ git clone [https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git](https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git)
41
+ cd fitsms-python-sdk
42
+ pip install .
fitsms-1.0.0/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # FitSMS Python SDK (v4)
2
+
3
+ The official Python SDK for the [FitSMS.lk](https://fitsms.lk) gateway, maintained by **Global Cloud Media**. Seamlessly integrate SMS capabilities into your Python applications, automation scripts, and AI agents.
4
+
5
+ ## Features
6
+ * **Sri Lankan Number Formatting**: Automatically handles `07...` and `7...` formats to the required `947...` standard.
7
+ * **v4 API Integration**: Fully compatible with the latest FitSMS REST API.
8
+ * **Lightweight**: Minimal dependencies (uses `requests`).
9
+ * **DevOps Ready**: Perfect for VPS monitoring and alert scripts.
10
+
11
+ ---
12
+
13
+ ## Installation
14
+
15
+ ### From Source (Local Development)
16
+ ```bash
17
+ git clone [https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git](https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git)
18
+ cd fitsms-python-sdk
19
+ pip install .
@@ -0,0 +1,9 @@
1
+ # fitsms/__init__.py
2
+
3
+ from .client import FitSMS
4
+
5
+ __version__ = "1.0.0"
6
+ __author__ = "Danuja Dilanka"
7
+
8
+ # This makes 'FitSMS' the primary export of the package
9
+ __all__ = ["FitSMS"]
@@ -0,0 +1,73 @@
1
+ import requests
2
+ import re
3
+
4
+ class FitSMS:
5
+ def __init__(self, api_token, sender_id):
6
+ self.api_token = api_token
7
+ self.sender_id = sender_id
8
+ self.v4_base = "https://app.fitsms.lk/api/v4"
9
+ self.headers = {
10
+ "Authorization": f"Bearer {api_token}",
11
+ "Accept": "application/json"
12
+ }
13
+
14
+ def _format_number(self, phone):
15
+ """Standardizes SL numbers to 947XXXXXXXX format."""
16
+ cleaned = re.sub(r'\D', '', str(phone))
17
+ if cleaned.startswith('07') and len(cleaned) == 10:
18
+ cleaned = '94' + cleaned[1:]
19
+ elif cleaned.startswith('7') and len(cleaned) == 9:
20
+ cleaned = '94' + cleaned
21
+ return cleaned
22
+
23
+ def send(self, recipients, message, sms_type="plain"):
24
+ """Sends SMS to one or more recipients."""
25
+ if isinstance(recipients, list):
26
+ recipients = ",".join([self._format_number(n) for n in recipients])
27
+ else:
28
+ recipients = self._format_number(recipients)
29
+
30
+ payload = {
31
+ "recipient": recipients,
32
+ "sender_id": self.sender_id,
33
+ "type": sms_type,
34
+ "message": message
35
+ }
36
+
37
+ try:
38
+ response = requests.post(f"{self.v4_base}/sms/send", json=payload, headers=self.headers)
39
+ response.raise_for_status()
40
+ return response.json()
41
+ except requests.exceptions.RequestException as e:
42
+ return {"status": "error", "message": str(e)}
43
+
44
+ def get_balance(self):
45
+ """Retrieves account balance."""
46
+ response = requests.get(f"{self.v4_base}/balance", headers=self.headers)
47
+ return response.json()
48
+
49
+ def get_status(self, ruid, phone):
50
+ """
51
+ Check the status of an existing SMS (v4 API).
52
+ :param ruid: The unique reference ID (received after sending)
53
+ :param phone: The recipient number
54
+ """
55
+ params = {
56
+ "recipient": self._format_number(phone)
57
+ }
58
+
59
+ try:
60
+ # v4 uses the ruid in the URL path
61
+ response = requests.get(
62
+ f"{self.v4_base}/sms/{ruid}",
63
+ params=params,
64
+ headers=self.headers
65
+ )
66
+ response.raise_for_status()
67
+ return response.json()
68
+ except requests.exceptions.RequestException as e:
69
+ # Handle cases where RUID is not found or API is down
70
+ return {
71
+ "status": "error",
72
+ "message": f"FitSMS Status Check Failed: {str(e)}"
73
+ }
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: fitsms
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for FitSMS.lk Gateway
5
+ Home-page: https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk
6
+ Author: Danuja Dilanka
7
+ Author-email: dilanka.rajapakshe1@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.1
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
23
+
24
+ # FitSMS Python SDK (v4)
25
+
26
+ The official Python SDK for the [FitSMS.lk](https://fitsms.lk) gateway, maintained by **Global Cloud Media**. Seamlessly integrate SMS capabilities into your Python applications, automation scripts, and AI agents.
27
+
28
+ ## Features
29
+ * **Sri Lankan Number Formatting**: Automatically handles `07...` and `7...` formats to the required `947...` standard.
30
+ * **v4 API Integration**: Fully compatible with the latest FitSMS REST API.
31
+ * **Lightweight**: Minimal dependencies (uses `requests`).
32
+ * **DevOps Ready**: Perfect for VPS monitoring and alert scripts.
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ ### From Source (Local Development)
39
+ ```bash
40
+ git clone [https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git](https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk.git)
41
+ cd fitsms-python-sdk
42
+ pip install .
@@ -0,0 +1,9 @@
1
+ README.md
2
+ setup.py
3
+ fitsms/__init__.py
4
+ fitsms/client.py
5
+ fitsms.egg-info/PKG-INFO
6
+ fitsms.egg-info/SOURCES.txt
7
+ fitsms.egg-info/dependency_links.txt
8
+ fitsms.egg-info/requires.txt
9
+ fitsms.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.25.1
@@ -0,0 +1 @@
1
+ fitsms
fitsms-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
fitsms-1.0.0/setup.py ADDED
@@ -0,0 +1,23 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r", encoding="utf-8") as fh:
4
+ long_description = fh.read()
5
+
6
+ setup(
7
+ name="fitsms",
8
+ version="1.0.0",
9
+ author="Danuja Dilanka",
10
+ author_email="dilanka.rajapakshe1@gmail.com",
11
+ description="Official Python SDK for FitSMS.lk Gateway",
12
+ long_description=long_description,
13
+ long_description_content_type="text/markdown",
14
+ url="https://github.com/Global-Cloud-Media-Pvt-Ltd/fitsms-python-sdk",
15
+ packages=find_packages(),
16
+ classifiers=[
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ],
21
+ install_requires=["requests>=2.25.1"],
22
+ python_requires='>=3.6',
23
+ )