PySyriatel 2.1.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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Syriatel Cash API
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.
22
+
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: PySyriatel
3
+ Version: 2.1.1
4
+ Summary: Python client for Syriatel API
5
+ Author-email: melchersman <melchersman@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/melchersman/PySyriatel
8
+ Project-URL: Documentation, https://api.melchersman.com/syr-cash/api-docs
9
+ Project-URL: Repository, https://github.com/melchersman/PySyriatel
10
+ Project-URL: Issues, https://github.com/melchersman/PySyriatel/issues
11
+ Keywords: syriatel,cash,api,syria,payment,mobile,money
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
24
+ Requires-Python: >=3.7
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: aiohttp>=3.8.0
28
+ Requires-Dist: requests>=2.28.0
29
+ Dynamic: license-file
30
+
31
+ # PySyriatel
32
+
33
+ Python client for Syriatel API.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install PySyriatel
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ### Async
44
+
45
+ ```python
46
+ from syriatel import SyriatelAPI
47
+
48
+ async with SyriatelAPI(api_token="your_token") as api:
49
+ # Get registered numbers
50
+ numbers = await api.get_numbers()
51
+ codes = await api.get_codes()
52
+ numbers_codes = await api.get_numbers_codes()
53
+
54
+ # Syriatel Cash - accepts phone number or secret code (auto-detected)
55
+ balance = await api.syrcash.balance("0991234567") # Phone number
56
+ balance = await api.syrcash.balance("65656565") # Secret code as string
57
+ balance = await api.syrcash.balance(65656565) # Secret code as int
58
+
59
+ # Get transaction history (only successful transactions by default)
60
+ incoming = await api.syrcash.get_incoming_history("0991234567")
61
+
62
+ # Get all transactions including failed ones
63
+ all_tx = await api.syrcash.get_incoming_history("0991234567", status="all")
64
+
65
+ # Get only failed transactions
66
+ failed = await api.syrcash.get_incoming_history("0991234567", status="failed")
67
+
68
+ # Date filtering
69
+ incoming = await api.syrcash.get_incoming_history(
70
+ "0991234567",
71
+ start_at="2024-01-01",
72
+ end_at="2024-12-31"
73
+ )
74
+
75
+ outgoing = await api.syrcash.get_outgoing_history("0991234567")
76
+
77
+ tx = await api.syrcash.find_incoming_transaction(
78
+ "6036565056",
79
+ query="0991234567"
80
+ )
81
+ ```
82
+
83
+ ### Sync
84
+
85
+ ```python
86
+ from syriatel import SyriatelAPISync
87
+
88
+ with SyriatelAPISync(api_token="your_token") as api:
89
+ numbers = api.get_numbers()
90
+ balance = api.syrcash.balance("0991234567")
91
+ balance = api.syrcash.balance(65656565) # Secret code as int works too
92
+ incoming = api.syrcash.get_incoming_history("0991234567")
93
+ ```
94
+
95
+ ## API
96
+
97
+ ### SyriatelAPI / SyriatelAPISync
98
+
99
+ | Method | Returns | Description |
100
+ |--------|---------|-------------|
101
+ | `get_numbers()` | `List[str]` | Active phone numbers |
102
+ | `get_codes()` | `List[str]` | Secret codes |
103
+ | `get_numbers_codes()` | `List[Tuple[str, str]]` | Number and code pairs |
104
+
105
+ ### api.syrcash
106
+
107
+ | Method | Returns | Description |
108
+ |--------|---------|-------------|
109
+ | `balance(query)` | `float` | Balance in SYP. Accepts phone number or secret code (auto-detected) |
110
+ | `get_incoming_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Incoming transfers |
111
+ | `get_outgoing_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Outgoing transfers |
112
+ | `find_incoming_transaction(transaction_no, query)` | `Transaction` | Find by transaction number |
113
+
114
+ **Notes:**
115
+ - `query` parameter auto-detects: if 10 digits starting with `09`, it's a phone number, otherwise it's a secret code
116
+ - `status` parameter: `"success"` (default), `"failed"`, or `"all"`
117
+ - Phone numbers and secret codes can be passed as strings or integers
118
+
119
+ ### Transaction
120
+
121
+ ```python
122
+ @dataclass
123
+ class Transaction:
124
+ transaction_no: str
125
+ date: str
126
+ from_gsm: str
127
+ to_gsm: str
128
+ amount: float
129
+ fee: float
130
+ net: float
131
+ channel: str
132
+ status: str
133
+ ```
134
+
135
+ ## Error Handling
136
+
137
+ ```python
138
+ from syriatel import (
139
+ SyriatelAPIError,
140
+ InvalidTokenError,
141
+ SubscriptionExpiredError,
142
+ FetchFailedError,
143
+ NetworkError,
144
+ )
145
+
146
+ try:
147
+ balance = await api.syrcash.balance("0991234567")
148
+ except SubscriptionExpiredError:
149
+ print("Subscription expired")
150
+ except InvalidTokenError:
151
+ print("Invalid token")
152
+ except NetworkError as e:
153
+ print(f"Network error: {e}")
154
+ ```
155
+
156
+ ## Rate Limits
157
+
158
+ - Balance: 5 requests per minute per number
159
+ - History: 5 requests per minute per number
160
+
161
+ ## License
162
+
163
+ MIT
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: PySyriatel
3
+ Version: 2.1.1
4
+ Summary: Python client for Syriatel API
5
+ Author-email: melchersman <melchersman@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/melchersman/PySyriatel
8
+ Project-URL: Documentation, https://api.melchersman.com/syr-cash/api-docs
9
+ Project-URL: Repository, https://github.com/melchersman/PySyriatel
10
+ Project-URL: Issues, https://github.com/melchersman/PySyriatel/issues
11
+ Keywords: syriatel,cash,api,syria,payment,mobile,money
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
24
+ Requires-Python: >=3.7
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: aiohttp>=3.8.0
28
+ Requires-Dist: requests>=2.28.0
29
+ Dynamic: license-file
30
+
31
+ # PySyriatel
32
+
33
+ Python client for Syriatel API.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install PySyriatel
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ### Async
44
+
45
+ ```python
46
+ from syriatel import SyriatelAPI
47
+
48
+ async with SyriatelAPI(api_token="your_token") as api:
49
+ # Get registered numbers
50
+ numbers = await api.get_numbers()
51
+ codes = await api.get_codes()
52
+ numbers_codes = await api.get_numbers_codes()
53
+
54
+ # Syriatel Cash - accepts phone number or secret code (auto-detected)
55
+ balance = await api.syrcash.balance("0991234567") # Phone number
56
+ balance = await api.syrcash.balance("65656565") # Secret code as string
57
+ balance = await api.syrcash.balance(65656565) # Secret code as int
58
+
59
+ # Get transaction history (only successful transactions by default)
60
+ incoming = await api.syrcash.get_incoming_history("0991234567")
61
+
62
+ # Get all transactions including failed ones
63
+ all_tx = await api.syrcash.get_incoming_history("0991234567", status="all")
64
+
65
+ # Get only failed transactions
66
+ failed = await api.syrcash.get_incoming_history("0991234567", status="failed")
67
+
68
+ # Date filtering
69
+ incoming = await api.syrcash.get_incoming_history(
70
+ "0991234567",
71
+ start_at="2024-01-01",
72
+ end_at="2024-12-31"
73
+ )
74
+
75
+ outgoing = await api.syrcash.get_outgoing_history("0991234567")
76
+
77
+ tx = await api.syrcash.find_incoming_transaction(
78
+ "6036565056",
79
+ query="0991234567"
80
+ )
81
+ ```
82
+
83
+ ### Sync
84
+
85
+ ```python
86
+ from syriatel import SyriatelAPISync
87
+
88
+ with SyriatelAPISync(api_token="your_token") as api:
89
+ numbers = api.get_numbers()
90
+ balance = api.syrcash.balance("0991234567")
91
+ balance = api.syrcash.balance(65656565) # Secret code as int works too
92
+ incoming = api.syrcash.get_incoming_history("0991234567")
93
+ ```
94
+
95
+ ## API
96
+
97
+ ### SyriatelAPI / SyriatelAPISync
98
+
99
+ | Method | Returns | Description |
100
+ |--------|---------|-------------|
101
+ | `get_numbers()` | `List[str]` | Active phone numbers |
102
+ | `get_codes()` | `List[str]` | Secret codes |
103
+ | `get_numbers_codes()` | `List[Tuple[str, str]]` | Number and code pairs |
104
+
105
+ ### api.syrcash
106
+
107
+ | Method | Returns | Description |
108
+ |--------|---------|-------------|
109
+ | `balance(query)` | `float` | Balance in SYP. Accepts phone number or secret code (auto-detected) |
110
+ | `get_incoming_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Incoming transfers |
111
+ | `get_outgoing_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Outgoing transfers |
112
+ | `find_incoming_transaction(transaction_no, query)` | `Transaction` | Find by transaction number |
113
+
114
+ **Notes:**
115
+ - `query` parameter auto-detects: if 10 digits starting with `09`, it's a phone number, otherwise it's a secret code
116
+ - `status` parameter: `"success"` (default), `"failed"`, or `"all"`
117
+ - Phone numbers and secret codes can be passed as strings or integers
118
+
119
+ ### Transaction
120
+
121
+ ```python
122
+ @dataclass
123
+ class Transaction:
124
+ transaction_no: str
125
+ date: str
126
+ from_gsm: str
127
+ to_gsm: str
128
+ amount: float
129
+ fee: float
130
+ net: float
131
+ channel: str
132
+ status: str
133
+ ```
134
+
135
+ ## Error Handling
136
+
137
+ ```python
138
+ from syriatel import (
139
+ SyriatelAPIError,
140
+ InvalidTokenError,
141
+ SubscriptionExpiredError,
142
+ FetchFailedError,
143
+ NetworkError,
144
+ )
145
+
146
+ try:
147
+ balance = await api.syrcash.balance("0991234567")
148
+ except SubscriptionExpiredError:
149
+ print("Subscription expired")
150
+ except InvalidTokenError:
151
+ print("Invalid token")
152
+ except NetworkError as e:
153
+ print(f"Network error: {e}")
154
+ ```
155
+
156
+ ## Rate Limits
157
+
158
+ - Balance: 5 requests per minute per number
159
+ - History: 5 requests per minute per number
160
+
161
+ ## License
162
+
163
+ MIT
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ PySyriatel.egg-info/PKG-INFO
5
+ PySyriatel.egg-info/SOURCES.txt
6
+ PySyriatel.egg-info/dependency_links.txt
7
+ PySyriatel.egg-info/requires.txt
8
+ PySyriatel.egg-info/top_level.txt
9
+ syriatel/__init__.py
10
+ syriatel/client.py
11
+ syriatel/exceptions.py
12
+ syriatel/models.py
@@ -0,0 +1,2 @@
1
+ aiohttp>=3.8.0
2
+ requests>=2.28.0
@@ -0,0 +1 @@
1
+ syriatel
@@ -0,0 +1,133 @@
1
+ # PySyriatel
2
+
3
+ Python client for Syriatel API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install PySyriatel
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Async
14
+
15
+ ```python
16
+ from syriatel import SyriatelAPI
17
+
18
+ async with SyriatelAPI(api_token="your_token") as api:
19
+ # Get registered numbers
20
+ numbers = await api.get_numbers()
21
+ codes = await api.get_codes()
22
+ numbers_codes = await api.get_numbers_codes()
23
+
24
+ # Syriatel Cash - accepts phone number or secret code (auto-detected)
25
+ balance = await api.syrcash.balance("0991234567") # Phone number
26
+ balance = await api.syrcash.balance("65656565") # Secret code as string
27
+ balance = await api.syrcash.balance(65656565) # Secret code as int
28
+
29
+ # Get transaction history (only successful transactions by default)
30
+ incoming = await api.syrcash.get_incoming_history("0991234567")
31
+
32
+ # Get all transactions including failed ones
33
+ all_tx = await api.syrcash.get_incoming_history("0991234567", status="all")
34
+
35
+ # Get only failed transactions
36
+ failed = await api.syrcash.get_incoming_history("0991234567", status="failed")
37
+
38
+ # Date filtering
39
+ incoming = await api.syrcash.get_incoming_history(
40
+ "0991234567",
41
+ start_at="2024-01-01",
42
+ end_at="2024-12-31"
43
+ )
44
+
45
+ outgoing = await api.syrcash.get_outgoing_history("0991234567")
46
+
47
+ tx = await api.syrcash.find_incoming_transaction(
48
+ "6036565056",
49
+ query="0991234567"
50
+ )
51
+ ```
52
+
53
+ ### Sync
54
+
55
+ ```python
56
+ from syriatel import SyriatelAPISync
57
+
58
+ with SyriatelAPISync(api_token="your_token") as api:
59
+ numbers = api.get_numbers()
60
+ balance = api.syrcash.balance("0991234567")
61
+ balance = api.syrcash.balance(65656565) # Secret code as int works too
62
+ incoming = api.syrcash.get_incoming_history("0991234567")
63
+ ```
64
+
65
+ ## API
66
+
67
+ ### SyriatelAPI / SyriatelAPISync
68
+
69
+ | Method | Returns | Description |
70
+ |--------|---------|-------------|
71
+ | `get_numbers()` | `List[str]` | Active phone numbers |
72
+ | `get_codes()` | `List[str]` | Secret codes |
73
+ | `get_numbers_codes()` | `List[Tuple[str, str]]` | Number and code pairs |
74
+
75
+ ### api.syrcash
76
+
77
+ | Method | Returns | Description |
78
+ |--------|---------|-------------|
79
+ | `balance(query)` | `float` | Balance in SYP. Accepts phone number or secret code (auto-detected) |
80
+ | `get_incoming_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Incoming transfers |
81
+ | `get_outgoing_history(query, page, status, start_at, end_at)` | `List[Transaction]` | Outgoing transfers |
82
+ | `find_incoming_transaction(transaction_no, query)` | `Transaction` | Find by transaction number |
83
+
84
+ **Notes:**
85
+ - `query` parameter auto-detects: if 10 digits starting with `09`, it's a phone number, otherwise it's a secret code
86
+ - `status` parameter: `"success"` (default), `"failed"`, or `"all"`
87
+ - Phone numbers and secret codes can be passed as strings or integers
88
+
89
+ ### Transaction
90
+
91
+ ```python
92
+ @dataclass
93
+ class Transaction:
94
+ transaction_no: str
95
+ date: str
96
+ from_gsm: str
97
+ to_gsm: str
98
+ amount: float
99
+ fee: float
100
+ net: float
101
+ channel: str
102
+ status: str
103
+ ```
104
+
105
+ ## Error Handling
106
+
107
+ ```python
108
+ from syriatel import (
109
+ SyriatelAPIError,
110
+ InvalidTokenError,
111
+ SubscriptionExpiredError,
112
+ FetchFailedError,
113
+ NetworkError,
114
+ )
115
+
116
+ try:
117
+ balance = await api.syrcash.balance("0991234567")
118
+ except SubscriptionExpiredError:
119
+ print("Subscription expired")
120
+ except InvalidTokenError:
121
+ print("Invalid token")
122
+ except NetworkError as e:
123
+ print(f"Network error: {e}")
124
+ ```
125
+
126
+ ## Rate Limits
127
+
128
+ - Balance: 5 requests per minute per number
129
+ - History: 5 requests per minute per number
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "PySyriatel"
7
+ version = "2.1.1"
8
+ description = "Python client for Syriatel API"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "melchersman", email = "melchersman@gmail.com" },
12
+ ]
13
+ license = { text = "MIT" }
14
+ requires-python = ">=3.7"
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.7",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
28
+ ]
29
+ keywords = ["syriatel", "cash", "api", "syria", "payment", "mobile", "money"]
30
+ dependencies = [
31
+ "aiohttp>=3.8.0",
32
+ "requests>=2.28.0",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/melchersman/PySyriatel"
37
+ Documentation = "https://api.melchersman.com/syr-cash/api-docs"
38
+ Repository = "https://github.com/melchersman/PySyriatel"
39
+ Issues = "https://github.com/melchersman/PySyriatel/issues"
40
+
41
+ [tool.setuptools]
42
+ packages = ["syriatel"]
43
+
44
+ [tool.setuptools.package-data]
45
+ syriatel = ["py.typed"]
46
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,43 @@
1
+ """
2
+ Syriatel API Python Library
3
+
4
+ A professional Python library for interacting with the Syriatel API.
5
+ Supports both async and sync operations.
6
+ """
7
+
8
+ from .client import SyriatelAPI, SyriatelAPISync, SyriatelCash
9
+ from .models import Transaction
10
+ from .exceptions import (
11
+ SyriatelAPIError,
12
+ InvalidTokenError,
13
+ SubscriptionExpiredError,
14
+ FetchFailedError,
15
+ NotAuthorizedError,
16
+ ServerMaintenanceError,
17
+ NetworkError,
18
+ GSMNotFoundError,
19
+ VerificationRequiredError,
20
+ VerificationFailedError,
21
+ PINInvalidError,
22
+ LoginFailedError,
23
+ )
24
+
25
+ __version__ = "2.0.3"
26
+ __all__ = [
27
+ "SyriatelAPI",
28
+ "SyriatelAPISync",
29
+ "SyriatelCash",
30
+ "Transaction",
31
+ "SyriatelAPIError",
32
+ "InvalidTokenError",
33
+ "SubscriptionExpiredError",
34
+ "FetchFailedError",
35
+ "NotAuthorizedError",
36
+ "ServerMaintenanceError",
37
+ "NetworkError",
38
+ "GSMNotFoundError",
39
+ "VerificationRequiredError",
40
+ "VerificationFailedError",
41
+ "PINInvalidError",
42
+ "LoginFailedError",
43
+ ]