Skip to main content

Python SDK for CloudSMS API

Project description

CloudSMS Python SDK

A Python SDK for the CloudSMS API, allowing you to easily integrate SMS functionality into your Python applications.

Installation

You can install the package using pip:

pip install cloudsms

Requirements

  • Python 3.6 or higher
  • requests>=2.25.0

Quick Start

from cloudsms import CloudSMSClient

# Initialize the client
client = CloudSMSClient(
    api_token="your-api-token",
    sender_id="your-sender-id"
)

# Test the connection
test_response = client.test_connection()
print(test_response["status"])  # 'success' or 'error'

# Check your balance
balance_response = client.get_balance()
if balance_response["status"] == "success":
    print(f"Current balance: {balance_response['data']}")

# Send an SMS
sms_response = client.send_sms(
    phone_number="+1234567890",
    message="Hello from CloudSMS!"
)
if sms_response["status"] == "success":
    print("SMS sent successfully!")
else:
    print(f"Error: {sms_response['message']}")

API Reference

CloudSMSClient

The main class for interacting with the CloudSMS API.

Constructor

client = CloudSMSClient(api_token: str = "", sender_id: str = "")
  • api_token: Your CloudSMS API token
  • sender_id: Your CloudSMS sender ID

Methods

get_balance()

Get your current account balance.

response = client.get_balance()

Returns:

{
    "status": "success",
    "data": "100.00"  # Balance amount without currency symbol
}
test_connection()

Test the API connection.

response = client.test_connection()

Returns:

{
    "status": "success",
    "message": "Connection successful! Your account is properly configured."
}
send_sms(phone_number: str, message: str)

Send an SMS message.

response = client.send_sms(
    phone_number="+1234567890",
    message="Hello from CloudSMS!"
)

Returns:

{
    "status": "success",
    "success": True
}

Error Handling

All methods return a dictionary with at least a "status" key that can be either "success" or "error". When an error occurs, the response will include an error message:

{
    "status": "error",
    "message": "Error description here"
}

License

This project is licensed under the MIT License.

Support

For support, please visit https://cloudsms.gr or contact info@gsoftware.gr.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudsms-1.0.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudsms-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file cloudsms-1.0.0.tar.gz.

File metadata

  • Download URL: cloudsms-1.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.10

File hashes

Hashes for cloudsms-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5eebf0bf3c6e57048df1589d3c96cea9bdbfd36ccc706b00eb3f3b30499008b7
MD5 828cdb30440cea71749c4b28ca7ee058
BLAKE2b-256 f9174b0a1bfebf21af9a820e087df23489c36be72c2d1f564b612b7ccb00c305

See more details on using hashes here.

File details

Details for the file cloudsms-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cloudsms-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.10

File hashes

Hashes for cloudsms-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa8348d628f05c29e36bbe00ae15e7cbcb5bbcea25587cf6012c643ca81eb107
MD5 3b0c7b7f0ad08a89eb9c9c47f14c8988
BLAKE2b-256 21e44212c059bbedba62e7cff23fd118dd01ab610e16b5ab29affb6e0056ffa0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page