Python client for the Free Mobile SMS API — send SMS notifications programmatically.
Project description
freemobile-sms
Python client for the Free Mobile SMS API. Send SMS notifications to your Free Mobile phone programmatically.
Installation
pip install freemobile-sms-client
Quick Start
Environment Variables
export FREE_MOBILE_USER=12345678 # Your Free Mobile customer ID
export FREE_MOBILE_PASSWORD=yourApiKey # Your API key (from your Free Mobile account)
Python (Programmatic)
from freemobile_sms import FreeMobileClient
# Uses FREE_MOBILE_USER / FREE_MOBILE_PASSWORD from environment
with FreeMobileClient() as client:
result = client.send("Server alert: disk usage at 90%")
print(result.ok) # True
print(result.message) # "SMS sent successfully"
Or with explicit credentials:
from freemobile_sms import FreeMobileClient, FreeMobileSettings
settings = FreeMobileSettings(user="12345678", password="yourApiKey")
with FreeMobileClient(settings=settings) as client:
result = client.send("Hello from Python!")
POST Method (No URL Encoding)
The API supports POST requests where the message doesn't need to be URL-encoded:
with FreeMobileClient() as client:
result = client.send("Hello with émojis and special chars!", method="POST")
Async Python
from freemobile_sms import AsyncFreeMobileClient
async with AsyncFreeMobileClient() as client:
result = await client.send("Async alert!")
print(result.message)
CLI
# Using environment variables
freemobile-sms send "Hello from the command line!"
# Using options
freemobile-sms send "Hello!" --user 12345678 --password yourApiKey
# Using POST method (no URL encoding needed)
freemobile-sms send "Hello!" --method POST --user 12345678 --password yourApiKey
API Reference
FreeMobileClient
Synchronous client. Use as a context manager for automatic cleanup.
| Method | Description |
|---|---|
send(message, method="GET") |
Send an SMS. Returns SMSResult. Use method="POST" to avoid URL-encoding. |
AsyncFreeMobileClient
Asynchronous client. Same interface, but send() is async.
FreeMobileSettings
Pydantic Settings model. Reads from environment variables with FREE_MOBILE_ prefix, or from a .env file.
| Field | Env var | Default |
|---|---|---|
user |
FREE_MOBILE_USER |
"" |
password |
FREE_MOBILE_PASSWORD |
"" |
api_url |
FREE_MOBILE_API_URL |
https://smsapi.free-mobile.fr/sendmsg |
SMSResult
| Field | Type | Description |
|---|---|---|
success |
bool |
Whether the SMS was sent |
status_code |
int |
HTTP status code from the API |
message |
str |
Human-readable description |
ok |
bool |
Alias for success |
Exceptions
| Exception | Status | Description |
|---|---|---|
FreeMobileClientError |
— | Base exception |
RateLimitError |
402 | Too many SMS sent in too short a time |
AccessDeniedError |
403 | Service not activated or incorrect login/key |
ServerError |
500 | Free Mobile server error |
Development
# Install with dev dependencies
uv pip install -e ".[dev]"
# Run tests with coverage (requires 100%)
pytest
# Lint and format
ruff check .
ruff format .
# Install pre-commit hooks
pre-commit install
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freemobile_sms_client-0.1.0.tar.gz.
File metadata
- Download URL: freemobile_sms_client-0.1.0.tar.gz
- Upload date:
- Size: 83.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5121f5cb4da007de73fc644575e4d6802a3e42916c20bf0acb5546533a00842b
|
|
| MD5 |
1e787eab90b0b09a476e928c7250643c
|
|
| BLAKE2b-256 |
12344e244be4c9f2cc723e0f94ceb1793fa9b09fa3b24727494ca4a943041bbb
|
Provenance
The following attestation bundles were made for freemobile_sms_client-0.1.0.tar.gz:
Publisher:
release.yml on kemar-openclaw/freemobile-sms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freemobile_sms_client-0.1.0.tar.gz -
Subject digest:
5121f5cb4da007de73fc644575e4d6802a3e42916c20bf0acb5546533a00842b - Sigstore transparency entry: 1348272471
- Sigstore integration time:
-
Permalink:
kemar-openclaw/freemobile-sms@2a8deaf461784784fd7a25d0297f57e9766af904 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/kemar-openclaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2a8deaf461784784fd7a25d0297f57e9766af904 -
Trigger Event:
push
-
Statement type:
File details
Details for the file freemobile_sms_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: freemobile_sms_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5036101d8563a94c8b9680a87a96286c5f2e370c6a9d93591dc51913c61d90d
|
|
| MD5 |
56f59563baab3c95ab633b0bf2ee016d
|
|
| BLAKE2b-256 |
a4f2e17d15893b9814138dbc45c4457301c3c8f910dc44ec41da0f6cc422a507
|
Provenance
The following attestation bundles were made for freemobile_sms_client-0.1.0-py3-none-any.whl:
Publisher:
release.yml on kemar-openclaw/freemobile-sms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freemobile_sms_client-0.1.0-py3-none-any.whl -
Subject digest:
a5036101d8563a94c8b9680a87a96286c5f2e370c6a9d93591dc51913c61d90d - Sigstore transparency entry: 1348272551
- Sigstore integration time:
-
Permalink:
kemar-openclaw/freemobile-sms@2a8deaf461784784fd7a25d0297f57e9766af904 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/kemar-openclaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2a8deaf461784784fd7a25d0297f57e9766af904 -
Trigger Event:
push
-
Statement type: