smsbower 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,46 @@
1
+ # Dependencies
2
+ node_modules/
3
+ .pnp.*
4
+ .yarn/
5
+ .pnpm-store/
6
+
7
+ # Build
8
+ dist/
9
+ build/
10
+ *.tsbuildinfo
11
+ *.egg-info/
12
+ .eggs/
13
+ wheels/
14
+
15
+ # Tests and coverage
16
+ coverage/
17
+ .nyc_output/
18
+ .pytest_cache/
19
+ .mypy_cache/
20
+ .ruff_cache/
21
+ htmlcov/
22
+ .coverage
23
+ .coverage.*
24
+
25
+ # Python
26
+ __pycache__/
27
+ *.py[cod]
28
+ *$py.class
29
+ .venv/
30
+ venv/
31
+ env/
32
+
33
+ # Secrets
34
+ .env
35
+ .env.*
36
+ !.env.example
37
+ AGENTS.md
38
+
39
+ # GitBook / HonKit
40
+ _book/
41
+
42
+ # OS and editors
43
+ .DS_Store
44
+ Thumbs.db
45
+ .idea/
46
+ *.swp
smsbower-0.1.0/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 api-kit contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.5
2
+ Name: smsbower
3
+ Version: 0.1.0
4
+ Summary: Python client for the SMSBower virtual number and SMS activation API
5
+ Project-URL: Repository, https://github.com/TysikGG/api-kit
6
+ Project-URL: Documentation, https://smsbower.app/api?page=client
7
+ License-Expression: ISC
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: httpx>=0.27
11
+ Description-Content-Type: text/markdown
12
+
13
+ # smsbower
14
+
15
+ [![PyPI version](https://img.shields.io/pypi/v/smsbower.svg)](https://pypi.org/project/smsbower/)
16
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](LICENSE)
17
+ [![Python Version](https://img.shields.io/pypi/pyversions/smsbower.svg)](https://pypi.org/project/smsbower/)
18
+
19
+ Modern, fully typed Python client library for the [SMSBower](https://smsbower.com) virtual phone numbers and SMS OTP receiving API.
20
+
21
+ Official API documentation: <https://smsbower.com/api.html>
22
+
23
+ ---
24
+
25
+ ## Features
26
+
27
+ - 📱 **Virtual Phone Numbers** — Disposable phone numbers across 200+ countries for Telegram, WhatsApp, Discord, Google, and more.
28
+ - 🔄 **Full Activation Lifecycle** — Reserve numbers, mark ready, poll for incoming SMS OTP codes, complete, or cancel.
29
+ - 🐍 **Modern Pythonic Design** — Type annotations, dataclass models (`ActivationNumber`, `ActivationStatus`), context manager support (`with SmsBowerClient(...) as client:`), and custom exceptions.
30
+ - 🏷️ **Comprehensive Pricing** — V1, V2, and V3 pricing queries, service catalogs, top country recommendations, and availability stats.
31
+
32
+ ---
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install smsbower
38
+ ```
39
+
40
+ Requires Python 3.10 or higher.
41
+
42
+ ---
43
+
44
+ ## Quick Start (Safe Check)
45
+
46
+ The quick check only inspects your account balance and supported countries. It does not order numbers or consume funds:
47
+
48
+ ```python
49
+ import os
50
+ from smsbower import SmsBowerClient
51
+
52
+ with SmsBowerClient(api_key=os.environ["SMSBOWER_API_KEY"]) as client:
53
+ balance = client.get_balance()
54
+ print(f"Current SMSBower balance: {balance:.2f} RUB")
55
+
56
+ countries = client.get_countries()
57
+ print(f"Supported countries count: {len(countries)}")
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Usage Guide
63
+
64
+ ### 1. Renting a Number and Receiving an SMS Code
65
+
66
+ Full activation lifecycle: order a number, notify readiness, poll for the incoming verification code, and complete the order:
67
+
68
+ ```python
69
+ import time
70
+ from smsbower import SmsBowerClient
71
+
72
+ with SmsBowerClient(api_key="your_api_key") as client:
73
+ # 1. Order a number for Telegram in USA (country '187')
74
+ order = client.get_number(service="tg", country="187")
75
+ print(f"Rented Number: +{order.number} (Activation ID: {order.activation_id})")
76
+
77
+ # 2. Notify provider that you are ready to receive the SMS (status 1)
78
+ client.set_status(order.activation_id, 1)
79
+
80
+ # 3. Poll for the incoming verification code
81
+ code = None
82
+ for _ in range(30):
83
+ time.sleep(3)
84
+ res = client.get_status(order.activation_id)
85
+ if res.status == "STATUS_OK" and res.code:
86
+ code = res.code
87
+ break
88
+
89
+ if code:
90
+ print(f"Received verification code: {code}")
91
+ # 4. Mark activation completed (status 6)
92
+ client.set_status(order.activation_id, 6)
93
+ else:
94
+ print("SMS did not arrive. Cancelling activation to refund balance (status 8)...")
95
+ client.set_status(order.activation_id, 8)
96
+ ```
97
+
98
+ ### 2. Searching Prices and Stock Availability
99
+
100
+ Query real-time prices and availability across services and countries:
101
+
102
+ ```python
103
+ # Query prices across countries for Telegram
104
+ prices = client.get_prices("tg")
105
+ print("Prices for Telegram:", prices)
106
+
107
+ # Inspect top recommended countries for Telegram
108
+ top = client.get_top_countries_by_service("tg")
109
+ print("Top countries:", top)
110
+ ```
111
+
112
+ ---
113
+
114
+ ## API Reference
115
+
116
+ ### `SmsBowerClient` Class
117
+
118
+ #### Constructor
119
+
120
+ ```python
121
+ SmsBowerClient(
122
+ api_key: str,
123
+ base_url: str = "https://smsbower.com",
124
+ timeout: float = 30.0,
125
+ )
126
+ ```
127
+
128
+ | Parameter | Type | Default | Description |
129
+ | :--- | :--- | :--- | :--- |
130
+ | `api_key` | `str` | **Required** | Your SMSBower API key. |
131
+ | `base_url` | `str` | `"https://smsbower.com"` | Base URL of SMSBower API. |
132
+ | `timeout` | `float` | `30.0` | Request timeout in seconds. |
133
+
134
+ #### Methods
135
+
136
+ - **`get_balance() -> float`** — Retrieves account balance in RUB.
137
+ - **`get_number(service, country=None, ...) -> ActivationNumber`** — Orders a number (`activation_id`, `number`).
138
+ - **`get_number_v2(service, country=None, ...) -> ActivationNumberV2`** — Orders number using extended V2 format.
139
+ - **`get_status(activation_id: str | int) -> ActivationStatus`** — Checks activation state and code (`STATUS_WAIT_CODE`, `STATUS_OK`).
140
+ - **`set_status(activation_id: str | int, status: int) -> str`** — Sets activation state (1 = ready, 6 = complete, 8 = cancel).
141
+ - **`get_prices(service=None, country=None) -> Any`** — Returns V1 prices and availability.
142
+ - **`get_prices_v2(service=None, country=None) -> Any`** — Returns V2 prices.
143
+ - **`get_prices_v3(service=None, country=None) -> Any`** — Returns V3 prices.
144
+ - **`get_services_list() -> list[ServiceItem]`** — Lists all supported services.
145
+ - **`get_countries() -> dict[str, CountryItem]`** — Lists all supported countries.
146
+ - **`get_top_countries_by_service(service: str) -> dict[str, Any]`** — Recommended countries for service.
147
+ - **`get_actual_wallet_address(coin: str, network: str) -> str`** — Returns deposit wallet address for top-up.
148
+
149
+ ---
150
+
151
+ ## Error Handling
152
+
153
+ When the API returns an error status code, `SmsBowerError` is raised:
154
+
155
+ ```python
156
+ from smsbower import SmsBowerClient, SmsBowerError
157
+
158
+ try:
159
+ with SmsBowerClient(api_key="invalid_key") as client:
160
+ client.get_balance()
161
+ except SmsBowerError as exc:
162
+ print(f"SMSBower Error: {exc.message} (Code: {exc.code})")
163
+ ```
164
+
165
+ Common error codes:
166
+ - `NO_NUMBERS` — No available numbers for selected service/country.
167
+ - `NO_BALANCE` — Insufficient funds on account.
168
+ - `BAD_KEY` — Invalid API key.
169
+ - `BAD_ACTION` — Invalid action requested.
170
+ - `WRONG_ACTIVATION_ID` — Activation ID does not exist or expired.
171
+
172
+ ---
173
+
174
+ ## License
175
+
176
+ ISC
@@ -0,0 +1,164 @@
1
+ # smsbower
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/smsbower.svg)](https://pypi.org/project/smsbower/)
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](LICENSE)
5
+ [![Python Version](https://img.shields.io/pypi/pyversions/smsbower.svg)](https://pypi.org/project/smsbower/)
6
+
7
+ Modern, fully typed Python client library for the [SMSBower](https://smsbower.com) virtual phone numbers and SMS OTP receiving API.
8
+
9
+ Official API documentation: <https://smsbower.com/api.html>
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ - 📱 **Virtual Phone Numbers** — Disposable phone numbers across 200+ countries for Telegram, WhatsApp, Discord, Google, and more.
16
+ - 🔄 **Full Activation Lifecycle** — Reserve numbers, mark ready, poll for incoming SMS OTP codes, complete, or cancel.
17
+ - 🐍 **Modern Pythonic Design** — Type annotations, dataclass models (`ActivationNumber`, `ActivationStatus`), context manager support (`with SmsBowerClient(...) as client:`), and custom exceptions.
18
+ - 🏷️ **Comprehensive Pricing** — V1, V2, and V3 pricing queries, service catalogs, top country recommendations, and availability stats.
19
+
20
+ ---
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install smsbower
26
+ ```
27
+
28
+ Requires Python 3.10 or higher.
29
+
30
+ ---
31
+
32
+ ## Quick Start (Safe Check)
33
+
34
+ The quick check only inspects your account balance and supported countries. It does not order numbers or consume funds:
35
+
36
+ ```python
37
+ import os
38
+ from smsbower import SmsBowerClient
39
+
40
+ with SmsBowerClient(api_key=os.environ["SMSBOWER_API_KEY"]) as client:
41
+ balance = client.get_balance()
42
+ print(f"Current SMSBower balance: {balance:.2f} RUB")
43
+
44
+ countries = client.get_countries()
45
+ print(f"Supported countries count: {len(countries)}")
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Usage Guide
51
+
52
+ ### 1. Renting a Number and Receiving an SMS Code
53
+
54
+ Full activation lifecycle: order a number, notify readiness, poll for the incoming verification code, and complete the order:
55
+
56
+ ```python
57
+ import time
58
+ from smsbower import SmsBowerClient
59
+
60
+ with SmsBowerClient(api_key="your_api_key") as client:
61
+ # 1. Order a number for Telegram in USA (country '187')
62
+ order = client.get_number(service="tg", country="187")
63
+ print(f"Rented Number: +{order.number} (Activation ID: {order.activation_id})")
64
+
65
+ # 2. Notify provider that you are ready to receive the SMS (status 1)
66
+ client.set_status(order.activation_id, 1)
67
+
68
+ # 3. Poll for the incoming verification code
69
+ code = None
70
+ for _ in range(30):
71
+ time.sleep(3)
72
+ res = client.get_status(order.activation_id)
73
+ if res.status == "STATUS_OK" and res.code:
74
+ code = res.code
75
+ break
76
+
77
+ if code:
78
+ print(f"Received verification code: {code}")
79
+ # 4. Mark activation completed (status 6)
80
+ client.set_status(order.activation_id, 6)
81
+ else:
82
+ print("SMS did not arrive. Cancelling activation to refund balance (status 8)...")
83
+ client.set_status(order.activation_id, 8)
84
+ ```
85
+
86
+ ### 2. Searching Prices and Stock Availability
87
+
88
+ Query real-time prices and availability across services and countries:
89
+
90
+ ```python
91
+ # Query prices across countries for Telegram
92
+ prices = client.get_prices("tg")
93
+ print("Prices for Telegram:", prices)
94
+
95
+ # Inspect top recommended countries for Telegram
96
+ top = client.get_top_countries_by_service("tg")
97
+ print("Top countries:", top)
98
+ ```
99
+
100
+ ---
101
+
102
+ ## API Reference
103
+
104
+ ### `SmsBowerClient` Class
105
+
106
+ #### Constructor
107
+
108
+ ```python
109
+ SmsBowerClient(
110
+ api_key: str,
111
+ base_url: str = "https://smsbower.com",
112
+ timeout: float = 30.0,
113
+ )
114
+ ```
115
+
116
+ | Parameter | Type | Default | Description |
117
+ | :--- | :--- | :--- | :--- |
118
+ | `api_key` | `str` | **Required** | Your SMSBower API key. |
119
+ | `base_url` | `str` | `"https://smsbower.com"` | Base URL of SMSBower API. |
120
+ | `timeout` | `float` | `30.0` | Request timeout in seconds. |
121
+
122
+ #### Methods
123
+
124
+ - **`get_balance() -> float`** — Retrieves account balance in RUB.
125
+ - **`get_number(service, country=None, ...) -> ActivationNumber`** — Orders a number (`activation_id`, `number`).
126
+ - **`get_number_v2(service, country=None, ...) -> ActivationNumberV2`** — Orders number using extended V2 format.
127
+ - **`get_status(activation_id: str | int) -> ActivationStatus`** — Checks activation state and code (`STATUS_WAIT_CODE`, `STATUS_OK`).
128
+ - **`set_status(activation_id: str | int, status: int) -> str`** — Sets activation state (1 = ready, 6 = complete, 8 = cancel).
129
+ - **`get_prices(service=None, country=None) -> Any`** — Returns V1 prices and availability.
130
+ - **`get_prices_v2(service=None, country=None) -> Any`** — Returns V2 prices.
131
+ - **`get_prices_v3(service=None, country=None) -> Any`** — Returns V3 prices.
132
+ - **`get_services_list() -> list[ServiceItem]`** — Lists all supported services.
133
+ - **`get_countries() -> dict[str, CountryItem]`** — Lists all supported countries.
134
+ - **`get_top_countries_by_service(service: str) -> dict[str, Any]`** — Recommended countries for service.
135
+ - **`get_actual_wallet_address(coin: str, network: str) -> str`** — Returns deposit wallet address for top-up.
136
+
137
+ ---
138
+
139
+ ## Error Handling
140
+
141
+ When the API returns an error status code, `SmsBowerError` is raised:
142
+
143
+ ```python
144
+ from smsbower import SmsBowerClient, SmsBowerError
145
+
146
+ try:
147
+ with SmsBowerClient(api_key="invalid_key") as client:
148
+ client.get_balance()
149
+ except SmsBowerError as exc:
150
+ print(f"SMSBower Error: {exc.message} (Code: {exc.code})")
151
+ ```
152
+
153
+ Common error codes:
154
+ - `NO_NUMBERS` — No available numbers for selected service/country.
155
+ - `NO_BALANCE` — Insufficient funds on account.
156
+ - `BAD_KEY` — Invalid API key.
157
+ - `BAD_ACTION` — Invalid action requested.
158
+ - `WRONG_ACTIVATION_ID` — Activation ID does not exist or expired.
159
+
160
+ ---
161
+
162
+ ## License
163
+
164
+ ISC
@@ -0,0 +1,29 @@
1
+ """Quickstart example for the SMSBower Python client."""
2
+
3
+ import os
4
+ import sys
5
+
6
+ from smsbower import SmsBowerClient
7
+
8
+
9
+ def main() -> None:
10
+ api_key = os.environ.get("SMSBOWER_API_KEY")
11
+ if not api_key:
12
+ print("Please set the SMSBOWER_API_KEY environment variable", file=sys.stderr)
13
+ sys.exit(1)
14
+
15
+ with SmsBowerClient(api_key=api_key) as client:
16
+ balance = client.get_balance()
17
+ print(f"SMSBower Balance: ${balance:.2f}")
18
+
19
+ services = client.get_services_list()
20
+ print(f"Total services available: {len(services)}")
21
+ if services:
22
+ print("First service:", services[0])
23
+
24
+ countries = client.get_countries()
25
+ print(f"Total countries available: {len(countries)}")
26
+
27
+
28
+ if __name__ == "__main__":
29
+ main()
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "smsbower"
7
+ version = "0.1.0"
8
+ description = "Python client for the SMSBower virtual number and SMS activation API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "ISC"
12
+ dependencies = [
13
+ "httpx>=0.27",
14
+ ]
15
+
16
+ [project.urls]
17
+ Repository = "https://github.com/TysikGG/api-kit"
18
+ Documentation = "https://smsbower.app/api?page=client"
19
+
20
+ [dependency-groups]
21
+ dev = [
22
+ "pytest>=8",
23
+ "pytest-httpx>=0.30",
24
+ "ruff>=0.8",
25
+ ]
26
+
27
+ [tool.hatch.build.targets.wheel]
28
+ packages = ["src/smsbower"]
29
+
30
+ [tool.pytest.ini_options]
31
+ markers = [
32
+ "live: calls the real SMSBower API and needs SMSBOWER_API_KEY",
33
+ ]
34
+ testpaths = ["tests"]
35
+
36
+ [tool.ruff]
37
+ target-version = "py310"
38
+ line-length = 100
39
+ src = ["src", "tests", "examples"]
40
+
41
+ [tool.ruff.lint]
42
+ select = ["E", "F", "I", "UP"]
@@ -0,0 +1,15 @@
1
+ """SMSBower Python Client."""
2
+
3
+ from .client import DEFAULT_REF_ID, SmsBowerClient
4
+ from .errors import SmsBowerError
5
+ from .types import ActivationNumber, ActivationStatus, CountryItem, ServiceItem
6
+
7
+ __all__ = [
8
+ "DEFAULT_REF_ID",
9
+ "ActivationNumber",
10
+ "ActivationStatus",
11
+ "CountryItem",
12
+ "ServiceItem",
13
+ "SmsBowerClient",
14
+ "SmsBowerError",
15
+ ]