
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
beem-sms-python
Advanced tools
A professional Python SDK for sending SMS via the Beem SMS API. This package provides a simple, robust, and feature-rich interface for integrating SMS functionality into your Python applications.
pip install beem-sms-python
git clone https://github.com/islandkid-20/beem-sms-python.git
cd beem-sms-python
pip install -e .[dev]
from beem_sms import BeemSMSClient
# Initialize client
client = BeemSMSClient(
api_key="your_api_key",
secret_key="your_secret_key"
)
# Send SMS
response = client.send_sms(
source_addr="YourApp",
dest_addr="+255742892731",
message="Hello from Beem SMS!"
)
if response.success:
print(f"SMS sent! Request ID: {response.request_id}")
else:
print(f"Failed: {response.message}")
from beem_sms import BeemSMSClient
with BeemSMSClient("api_key", "secret_key") as client:
response = client.send_sms(
source_addr="YourApp",
dest_addr="+255742892731",
message="Hello World!"
)
recipients = ["+255742892731", "+255783346386", "+255713521250"]
results = client.send_bulk_sms(
source_addr="YourApp",
recipients=recipients,
message="Bulk SMS message",
batch_size=10
)
successful = sum(1 for r in results if r.success)
print(f"Sent {successful}/{len(results)} batches successfully")
from beem_sms import send_sms
response = send_sms(
api_key="your_api_key",
secret_key="your_secret_key",
source_addr="YourApp",
dest_addr="+255742892731",
message="Quick SMS!"
)
The package includes a command-line tool for quick SMS operations:
beem-sms send --api-key YOUR_KEY --secret-key YOUR_SECRET \
--sender "YourApp" --message "Hello CLI!" \
--recipients "+255742892731" "+255783346386"
# Create recipients.txt with one phone number per line
echo "+255742892731" > recipients.txt
echo "+255783346386" >> recipients.txt
beem-sms send --sender "YourApp" --message "Bulk message" \
--file recipients.txt --bulk --batch-size 50
beem-sms validate --numbers "+255742892731" "0783346386" "invalid"
Create ~/.beem_sms.json:
{
"api_key": "your_api_key",
"secret_key": "your_secret_key"
}
Then use CLI without credentials:
beem-sms send --sender "YourApp" --message "Hello!" \
--recipients "+255742892731"
The SDK provides specific exceptions for different error scenarios:
from beem_sms import (
BeemSMSClient,
AuthenticationError,
ValidationError,
APIError,
NetworkError
)
client = BeemSMSClient("api_key", "secret_key")
try:
response = client.send_sms(
source_addr="YourApp",
dest_addr="+255742892731",
message="Test message"
)
except AuthenticationError:
print("Invalid API credentials")
except ValidationError as e:
print(f"Invalid input: {e}")
except NetworkError:
print("Network connection failed")
except APIError as e:
print(f"API error: {e}")
from beem_sms import PhoneNumberValidator
# Validate single number
is_valid = PhoneNumberValidator.validate("+255742892731")
# Clean and format number
clean_number = PhoneNumberValidator.clean("0742892731")
# Returns: "+255742892731"
# Validate batch
numbers = ["+255742892731", "invalid", "0783346386"]
results = PhoneNumberValidator.validate_batch(numbers)
# Returns: [True, False, True]
import logging
# Custom logger
logger = logging.getLogger("my_app")
client = BeemSMSClient(
api_key="your_api_key",
secret_key="your_secret_key",
base_url="https://custom-endpoint.com/v1/send", # Custom endpoint
timeout=60, # 60 second timeout
max_retries=5, # 5 retry attempts
logger=logger # Custom logger
)
send_sms(source_addr, dest_addr, message, encoding=SMSEncoding.PLAIN_TEXT) - Send SMS to single or multiple recipientssend_bulk_sms(source_addr, recipients, message, encoding, batch_size=100) - Send bulk SMS with batchingsource_addr (str): Sender ID or phone numberdest_addr (str | List[str]): Recipient phone number(s)message (str): SMS message contentencoding (SMSEncoding): Message encoding (PLAIN_TEXT or UNICODE)Response object with the following attributes:
success (bool): Whether the operation succeededstatus_code (int): HTTP status codemessage (str): Response messageresponse_data (dict): Raw API response datarequest_id (str): Request ID for trackingSMSError - Base exceptionAuthenticationError - Invalid credentialsValidationError - Invalid input parametersAPIError - API request failedNetworkError - Network/connection issuesRun the test suite:
# Run all tests
make test
# Run with coverage
make test-cov
# Run specific test file
pytest tests/test_client.py -v
Set up development environment:
make dev-setup
Run code quality checks:
make check # Runs format-check, lint, type-check, and test
Format code:
make format
git checkout -b feature/amazing-feature)make check)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
.readthedocs.yml configuration fileMAX_MESSAGE_LENGTH from 160 to 153 * 3MAX_UNICODE_LENGTH from 70 to 67 * 3FAQs
Professional Python SDK for Beem SMS API
We found that beem-sms-python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.