Skip to content

Commit 852ffac

Browse files
committed
docs: sync README, CHANGELOG with v0.7.33-35 changes (v0.7.36)
Added missing CHANGELOG entries for v0.7.33 (GitGuardian), v0.7.34 (phone validation), v0.7.35 (badges). Documented find_country_code(), validate_phone_format(), and trunk prefix stripping in README.
1 parent 1a6086a commit 852ffac

4 files changed

Lines changed: 50 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
77

88
---
99

10+
## [0.7.35] - 2026-03-14
11+
12+
### Added
13+
- `README.md`: Downloads and GitGuardian badges
14+
15+
---
16+
17+
## [0.7.34] - 2026-03-14
18+
19+
### Added
20+
- Country-specific phone validation rules for 80+ countries (`_PHONE_RULES`)
21+
- `find_country_code()` function: find country code prefix from a normalized phone number
22+
- `validate_phone_format()` function: validate phone numbers against country-specific length and mobile prefix rules
23+
- Domestic trunk prefix stripping in `normalize_phone()` (e.g., `9660559...` becomes `966559...`)
24+
- Both new functions exported from top-level `kwtsms` package
25+
- 24 new phone validation tests
26+
27+
### Changed
28+
- `validate_phone_input()` now runs country-specific format validation after basic checks
29+
30+
---
31+
32+
## [0.7.33] - 2026-03-14
33+
34+
### Added
35+
- `.github/workflows/gitguardian.yml`: GitGuardian secret scanning on push and pull request
36+
37+
---
38+
1039
## [0.7.32] - 2026-03-13
1140

1241
### Removed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,15 @@ async def send_otp(phone: str, code: str):
399399
## Utility functions
400400

401401
```python
402-
from kwtsms import normalize_phone, validate_phone_input, clean_message, parse_webhook
402+
from kwtsms import (normalize_phone, validate_phone_input, clean_message,
403+
parse_webhook, find_country_code, validate_phone_format)
403404

404-
# Normalize a phone number: strips +, 00, spaces, dashes; converts Arabic digits
405+
# Normalize a phone number: strips +, 00, spaces, dashes; converts Arabic digits;
406+
# strips domestic trunk prefix (e.g. 9660559... becomes 966559...)
405407
normalize_phone("+96598765432") # → "96598765432"
406408
normalize_phone("00 965 9876-5432") # → "96598765432"
407409
normalize_phone("٩٦٥٩٨٧٦٥٤٣٢") # → "96598765432"
410+
normalize_phone("9660559123456") # → "966559123456" (Saudi trunk 0 stripped)
408411

409412
# Validate a phone number: returns (is_valid, error, normalized)
410413
ok, error, number = validate_phone_input("+96598765432")
@@ -416,6 +419,18 @@ ok, error, number = validate_phone_input("user@gmail.com")
416419
ok, error, number = validate_phone_input("123")
417420
# → (False, "'123' is too short to be a valid phone number (3 digits, minimum is 7)", "123")
418421

422+
ok, error, number = validate_phone_input("96512345678")
423+
# → (False, "Invalid Kuwait mobile number: after +965 must start with 4, 5, 6, 9", "96512345678")
424+
425+
# Find country code from a normalized number
426+
find_country_code("96598765432") # → "965" (Kuwait)
427+
find_country_code("12125551234") # → "1" (USA/Canada)
428+
find_country_code("8887654321") # → None (unknown)
429+
430+
# Validate phone format against country-specific rules (length + mobile prefix)
431+
valid, error = validate_phone_format("96598765432") # → (True, None)
432+
valid, error = validate_phone_format("96512345678") # → (False, "Invalid Kuwait mobile...")
433+
419434
# Clean message text: also called automatically inside send()
420435
clean_message("Your OTP is: ١٢٣٤٥٦ 🎉") # → "Your OTP is: 123456 "
421436
```
@@ -431,6 +446,8 @@ All phone numbers are normalized automatically before every API call:
431446
1. Arabic/Hindi digits (`٠١٢٣٤٥٦٧٨٩` / `۰۱۲۳۴۵۶۷۸۹`) → Latin (`0123456789`)
432447
2. All non-digit characters stripped (`+`, spaces, dashes, dots, brackets, etc.)
433448
3. Leading zeros stripped (handles `00` country code prefix)
449+
4. Domestic trunk prefix stripped after country code (e.g., `9660559...``966559...`)
450+
5. Country-specific validation: checks local number length and mobile prefix for 80+ countries
434451

435452
Numbers must include the country code (e.g., `96598765432` for Kuwait, not `98765432`).
436453

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "kwtsms"
3-
version = "0.7.35"
3+
version = "0.7.36"
44
description = "Python client for kwtSMS, the Kuwait SMS gateway trusted by top businesses to deliver messages worldwide, with private Sender ID, free API testing, and non-expiring credits."
55
readme = "README.md"
66
requires-python = ">=3.8"

src/kwtsms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
__all__ = ["KwtSMS", "AsyncKwtSMS", "normalize_phone", "clean_message",
2727
"validate_phone_input", "parse_webhook",
2828
"find_country_code", "validate_phone_format"]
29-
__version__ = "0.7.35"
29+
__version__ = "0.7.36"

0 commit comments

Comments
 (0)