farazsms 1.0.1__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.
farazsms-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FarazSMS
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,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: farazsms
3
+ Version: 1.0.1
4
+ Summary: Official client for FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک) — https://farazsms.com. Send pattern/OTP, bulk SMS, reports, phonebook, and all 63 endpoints.
5
+ Author: FarazSMS (فراز اس ام اس)
6
+ License: MIT
7
+ Project-URL: Homepage, https://farazsms.com
8
+ Project-URL: IranPayamak, https://iranpayamak.com
9
+ Project-URL: Documentation, https://farazsms.com
10
+ Project-URL: Source, https://gitlab.faraz.club/common-service-centres/api-docs
11
+ Keywords: farazsms,iranpayamak,sms,otp,pattern,iran,پیامک
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.20
16
+ Dynamic: license-file
17
+
18
+ # farazsms
19
+
20
+ **FarazSMS · IranPayamak** — فراز اس ام اس · ایران پیامک
21
+ 🌐 [farazsms.com](https://farazsms.com) · [iranpayamak.com](https://iranpayamak.com)
22
+
23
+ Official Python client for the **FarazSMS / IranPayamak** web services — send pattern/OTP, simple & bulk SMS, pull reports, manage your phonebook, and reach **all 63 endpoints** through a low-level `request()`.
24
+
25
+ Python 3.7+ · depends only on `requests` · raises on API errors.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pip install farazsms
31
+ ```
32
+
33
+ ## Quick start
34
+
35
+ ```python
36
+ from farazsms import FarazSMS, FarazError
37
+
38
+ sms = FarazSMS("YOUR_API_KEY") # key from the panel → Web Service / API Key
39
+
40
+ print(sms.balance()) # verify the key — free
41
+ sms.send_pattern("SJ3FgPrE0C", "09120000000", {"code": "1234"}) # OTP (instant)
42
+ sms.send_simple("Hello!", ["09120000000", "09130000000"]) # bulk
43
+ print(sms.inbox(page=1, limit=20)) # inbound replies
44
+
45
+ try:
46
+ sms.send_pattern("BAD", "09120000000", {"code": "1"})
47
+ except FarazError as e:
48
+ print(e.status, e.body)
49
+ ```
50
+
51
+ > Recipients use the local format `09120000000` (no `+98`). Default sender line `90008361`.
52
+
53
+ ## Bundled helpers
54
+
55
+ | Area | Methods |
56
+ |------|---------|
57
+ | Account | `balance()` · `profile()` · `lines()` |
58
+ | Send | `send_pattern()` · `send_simple()` · `send_variable()` |
59
+ | Patterns | `create_pattern()` · `patterns()` |
60
+ | Reports | `inbox()` · `send_requests()` · `send_request_items()` |
61
+ | Phonebook | `phonebooks()` · `add_contact()` |
62
+ | Reference | `provinces()` · `number_banks()` |
63
+
64
+ **Anything else** (tickets, orders, voice, LBS, …) via `request(method, path, body)`.
65
+
66
+ ## License
67
+
68
+ MIT
@@ -0,0 +1,51 @@
1
+ # farazsms
2
+
3
+ **FarazSMS · IranPayamak** — فراز اس ام اس · ایران پیامک
4
+ 🌐 [farazsms.com](https://farazsms.com) · [iranpayamak.com](https://iranpayamak.com)
5
+
6
+ Official Python client for the **FarazSMS / IranPayamak** web services — send pattern/OTP, simple & bulk SMS, pull reports, manage your phonebook, and reach **all 63 endpoints** through a low-level `request()`.
7
+
8
+ Python 3.7+ · depends only on `requests` · raises on API errors.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install farazsms
14
+ ```
15
+
16
+ ## Quick start
17
+
18
+ ```python
19
+ from farazsms import FarazSMS, FarazError
20
+
21
+ sms = FarazSMS("YOUR_API_KEY") # key from the panel → Web Service / API Key
22
+
23
+ print(sms.balance()) # verify the key — free
24
+ sms.send_pattern("SJ3FgPrE0C", "09120000000", {"code": "1234"}) # OTP (instant)
25
+ sms.send_simple("Hello!", ["09120000000", "09130000000"]) # bulk
26
+ print(sms.inbox(page=1, limit=20)) # inbound replies
27
+
28
+ try:
29
+ sms.send_pattern("BAD", "09120000000", {"code": "1"})
30
+ except FarazError as e:
31
+ print(e.status, e.body)
32
+ ```
33
+
34
+ > Recipients use the local format `09120000000` (no `+98`). Default sender line `90008361`.
35
+
36
+ ## Bundled helpers
37
+
38
+ | Area | Methods |
39
+ |------|---------|
40
+ | Account | `balance()` · `profile()` · `lines()` |
41
+ | Send | `send_pattern()` · `send_simple()` · `send_variable()` |
42
+ | Patterns | `create_pattern()` · `patterns()` |
43
+ | Reports | `inbox()` · `send_requests()` · `send_request_items()` |
44
+ | Phonebook | `phonebooks()` · `add_contact()` |
45
+ | Reference | `provinces()` · `number_banks()` |
46
+
47
+ **Anything else** (tickets, orders, voice, LBS, …) via `request(method, path, body)`.
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,98 @@
1
+ # FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک)
2
+ # Official client — https://farazsms.com · https://iranpayamak.com
3
+ """Lightweight official client for the FarazSMS / IranPayamak web services."""
4
+
5
+ import requests
6
+
7
+ __version__ = "1.0.1"
8
+ BASE = "https://api.iranpayamak.com"
9
+
10
+ __all__ = ["FarazSMS", "FarazError"]
11
+
12
+
13
+ class FarazError(Exception):
14
+ """Raised when the API returns an envelope with ``status == "error"``."""
15
+
16
+ def __init__(self, status, body):
17
+ super().__init__("[%s] %s" % (status, body))
18
+ self.status = status
19
+ self.body = body
20
+
21
+
22
+ class FarazSMS:
23
+ """Official client for the FarazSMS / IranPayamak web services.
24
+
25
+ See https://farazsms.com
26
+ """
27
+
28
+ def __init__(self, api_key, base_url=BASE):
29
+ if not api_key:
30
+ raise ValueError("FarazSMS: api_key is required")
31
+ self.base = base_url.rstrip("/")
32
+ self.s = requests.Session()
33
+ self.s.headers.update({"Api-Key": api_key, "Accept": "application/json"})
34
+
35
+ # low-level — reaches every one of the 63 endpoints
36
+ def request(self, method, path, body=None, params=None):
37
+ r = self.s.request(method, self.base + path, json=body, params=params, timeout=30)
38
+ data = r.json() if r.content else {}
39
+ if isinstance(data, dict) and data.get("status") == "error":
40
+ raise FarazError(r.status_code, data.get("message") or data)
41
+ return data
42
+
43
+ # account
44
+ def balance(self):
45
+ return self.request("GET", "/ws/v1/account/balance")
46
+
47
+ def profile(self):
48
+ return self.request("GET", "/ws/v1/account/profile")
49
+
50
+ def lines(self):
51
+ return self.request("GET", "/ws/v1/lines/accessible")
52
+
53
+ # send
54
+ def send_pattern(self, code, recipient, attributes, line_number="90008361"):
55
+ return self.request("POST", "/ws/v1/sms/pattern", {
56
+ "code": code, "recipient": recipient, "attributes": attributes,
57
+ "line_number": line_number, "number_format": "english"})
58
+
59
+ def send_simple(self, text, recipients, line_number="90008361"):
60
+ return self.request("POST", "/ws/v1/sms/simple", {
61
+ "text": text, "recipients": recipients,
62
+ "line_number": line_number, "number_format": "english"})
63
+
64
+ def send_variable(self, text, recipients, line_number="90008361"):
65
+ return self.request("POST", "/ws/v1/sms/keywords", {
66
+ "text": text, "recipients": recipients,
67
+ "line_number": line_number, "number_format": "english"})
68
+
69
+ # patterns
70
+ def create_pattern(self, payload):
71
+ return self.request("POST", "/ws/v1/patterns", payload)
72
+
73
+ def patterns(self, **params):
74
+ return self.request("GET", "/ws/v1/patterns", params=params)
75
+
76
+ # reports
77
+ def inbox(self, page=1, limit=20):
78
+ return self.request("GET", "/ws/v1/inbox", params={"page": page, "limit": limit})
79
+
80
+ def send_requests(self, **params):
81
+ return self.request("GET", "/ws/v1/send_request", params=params)
82
+
83
+ def send_request_items(self, send_request_id, **params):
84
+ return self.request("GET", "/ws/v1/send_request/%s/items" % send_request_id, params=params)
85
+
86
+ # phonebook
87
+ def phonebooks(self):
88
+ return self.request("GET", "/ws/v1/phone_book")
89
+
90
+ def add_contact(self, payload):
91
+ return self.request("POST", "/ws/v1/phone_book_data", payload)
92
+
93
+ # reference
94
+ def provinces(self, **params):
95
+ return self.request("GET", "/provinces", params=params)
96
+
97
+ def number_banks(self, **params):
98
+ return self.request("GET", "/ws/v1/number_bank", params=params)
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: farazsms
3
+ Version: 1.0.1
4
+ Summary: Official client for FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک) — https://farazsms.com. Send pattern/OTP, bulk SMS, reports, phonebook, and all 63 endpoints.
5
+ Author: FarazSMS (فراز اس ام اس)
6
+ License: MIT
7
+ Project-URL: Homepage, https://farazsms.com
8
+ Project-URL: IranPayamak, https://iranpayamak.com
9
+ Project-URL: Documentation, https://farazsms.com
10
+ Project-URL: Source, https://gitlab.faraz.club/common-service-centres/api-docs
11
+ Keywords: farazsms,iranpayamak,sms,otp,pattern,iran,پیامک
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.20
16
+ Dynamic: license-file
17
+
18
+ # farazsms
19
+
20
+ **FarazSMS · IranPayamak** — فراز اس ام اس · ایران پیامک
21
+ 🌐 [farazsms.com](https://farazsms.com) · [iranpayamak.com](https://iranpayamak.com)
22
+
23
+ Official Python client for the **FarazSMS / IranPayamak** web services — send pattern/OTP, simple & bulk SMS, pull reports, manage your phonebook, and reach **all 63 endpoints** through a low-level `request()`.
24
+
25
+ Python 3.7+ · depends only on `requests` · raises on API errors.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pip install farazsms
31
+ ```
32
+
33
+ ## Quick start
34
+
35
+ ```python
36
+ from farazsms import FarazSMS, FarazError
37
+
38
+ sms = FarazSMS("YOUR_API_KEY") # key from the panel → Web Service / API Key
39
+
40
+ print(sms.balance()) # verify the key — free
41
+ sms.send_pattern("SJ3FgPrE0C", "09120000000", {"code": "1234"}) # OTP (instant)
42
+ sms.send_simple("Hello!", ["09120000000", "09130000000"]) # bulk
43
+ print(sms.inbox(page=1, limit=20)) # inbound replies
44
+
45
+ try:
46
+ sms.send_pattern("BAD", "09120000000", {"code": "1"})
47
+ except FarazError as e:
48
+ print(e.status, e.body)
49
+ ```
50
+
51
+ > Recipients use the local format `09120000000` (no `+98`). Default sender line `90008361`.
52
+
53
+ ## Bundled helpers
54
+
55
+ | Area | Methods |
56
+ |------|---------|
57
+ | Account | `balance()` · `profile()` · `lines()` |
58
+ | Send | `send_pattern()` · `send_simple()` · `send_variable()` |
59
+ | Patterns | `create_pattern()` · `patterns()` |
60
+ | Reports | `inbox()` · `send_requests()` · `send_request_items()` |
61
+ | Phonebook | `phonebooks()` · `add_contact()` |
62
+ | Reference | `provinces()` · `number_banks()` |
63
+
64
+ **Anything else** (tickets, orders, voice, LBS, …) via `request(method, path, body)`.
65
+
66
+ ## License
67
+
68
+ MIT
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ farazsms/__init__.py
5
+ farazsms.egg-info/PKG-INFO
6
+ farazsms.egg-info/SOURCES.txt
7
+ farazsms.egg-info/dependency_links.txt
8
+ farazsms.egg-info/requires.txt
9
+ farazsms.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.20
@@ -0,0 +1 @@
1
+ farazsms
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "farazsms"
7
+ version = "1.0.1"
8
+ description = "Official client for FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک) — https://farazsms.com. Send pattern/OTP, bulk SMS, reports, phonebook, and all 63 endpoints."
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "FarazSMS (فراز اس ام اس)" }]
13
+ keywords = ["farazsms", "iranpayamak", "sms", "otp", "pattern", "iran", "پیامک"]
14
+ dependencies = ["requests>=2.20"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://farazsms.com"
18
+ IranPayamak = "https://iranpayamak.com"
19
+ Documentation = "https://farazsms.com"
20
+ Source = "https://gitlab.faraz.club/common-service-centres/api-docs"
21
+
22
+ [tool.setuptools]
23
+ packages = ["farazsms"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+