plasgate-sms


Nameplasgate-sms JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/plasgateCoLTD/python
SummaryPlasgate SMS API client
upload_time2024-10-18 09:11:00
maintainerNone
docs_urlNone
authorPlasgateCoLtd
requires_python>=3.7.0
licenseNone
keywords plasgate sms-api plasgate-otp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Plasgate SMS API Client

`plasgate` is a powerful Python library designed for seamless interaction with the Plasgate SMS API. It enables users to send SMS messages effortlessly and manage One-Time Passwords (OTPs) with ease.

## Features

- **Send SMS Messages**: Quickly send individual or batch SMS messages.
- **OTP Management**: Generate and validate OTPs for secure authentication.
- **Delivery Reports**: Track message delivery status with optional callbacks.
- **Batch Processing**: Efficiently send messages to multiple recipients in a single request.

## Installation

To install the `plasgate` library, use pip. Open your terminal and execute the following command:

```bash
pip install plasgate-sms
```

## Configuration

Before using the library, ensure you have your API keys from Plasgate. You'll need:

- **Private Key**: Unique identifier for your account.
- **Secret Key**: Used for authenticating requests.

These can usually be found in your Plasgate account settings.

## Usage

### Single Sending

To send a single SMS message, follow this example:

```python
from plasgate.rest import Client

# Initialize client with your API credentials
private = "PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
secret = "PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = Client(private, secret)

# Send a message
response = client.messages.create(
    to="855972432661",
    sender="PlasGate",  # Your sender ID
    content="TestAPI",   # Message content
    dlr="yes",           # Delivery report request
    dlr_url="https://webhook-test.com/273e777973dc8334bbaa2ef63f3d9cf6",  # URL for delivery reports
)

print(response)
```

### Batch Sending

For sending messages to multiple recipients at once, you can use batch sending:

```python
from plasgate.rest import Client

# Initialize client with your API credentials
private = "PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
secret = "PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = Client(private, secret, batch_sending=True)

# Send batch messages
response = client.messages.create(
    messages=[
        {"to": ["85581848677", "855972432661"], "content": "Test plasgate client"}
    ],
    globals={
        "sender": "PlasGate",  # Sender ID for all messages
        "dlr": "yes",           # Request delivery reports
        "dlr_level": 3,         # Level of detail for delivery reports
        "dlr_url": "https://webhook-test.com/273e777973dc8334bbaa2ef63f3d9cf6",  # URL for delivery reports
    },
)

print(response)
```

### Twilio Migration

If you are migrating from Twilio, you can use the same structure with Plasgate:

```python
from plasgate.rest import Client

# Initialize client with your API credentials
account_sid = "PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = Client(account_sid, auth_token)

# Send a message using the Twilio-like syntax
message = client.messages.create(
    to="+855972432661",  # Recipient's number
    from_="PlasGate",    # Your sender ID
    body="Hello from Python!"  # Message body
)

print(message)
```

## Additional Considerations

- **Error Handling**: Ensure you implement error handling to manage any issues with sending messages (e.g., invalid numbers, network errors).
- **Rate Limiting**: Be aware of any rate limits imposed by Plasgate to avoid disruptions in service.
- **Secure Your Keys**: Always keep your API keys confidential and do not expose them in public repositories.

For more information and detailed documentation, please refer to the official Plasgate API documentation.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/plasgateCoLTD/python",
    "name": "plasgate-sms",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7.0",
    "maintainer_email": null,
    "keywords": "plasgate, sms-api, plasgate-otp",
    "author": "PlasgateCoLtd",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/cc/77/34f91df966b7e2e04680e0dc8b727f68bf2879d7dbfbb311be8a0ebb3f3e/plasgate-sms-1.0.0.tar.gz",
    "platform": null,
    "description": "# Plasgate SMS API Client\n\n`plasgate` is a powerful Python library designed for seamless interaction with the Plasgate SMS API. It enables users to send SMS messages effortlessly and manage One-Time Passwords (OTPs) with ease.\n\n## Features\n\n- **Send SMS Messages**: Quickly send individual or batch SMS messages.\n- **OTP Management**: Generate and validate OTPs for secure authentication.\n- **Delivery Reports**: Track message delivery status with optional callbacks.\n- **Batch Processing**: Efficiently send messages to multiple recipients in a single request.\n\n## Installation\n\nTo install the `plasgate` library, use pip. Open your terminal and execute the following command:\n\n```bash\npip install plasgate-sms\n```\n\n## Configuration\n\nBefore using the library, ensure you have your API keys from Plasgate. You'll need:\n\n- **Private Key**: Unique identifier for your account.\n- **Secret Key**: Used for authenticating requests.\n\nThese can usually be found in your Plasgate account settings.\n\n## Usage\n\n### Single Sending\n\nTo send a single SMS message, follow this example:\n\n```python\nfrom plasgate.rest import Client\n\n# Initialize client with your API credentials\nprivate = \"PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nsecret = \"PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n\nclient = Client(private, secret)\n\n# Send a message\nresponse = client.messages.create(\n    to=\"855972432661\",\n    sender=\"PlasGate\",  # Your sender ID\n    content=\"TestAPI\",   # Message content\n    dlr=\"yes\",           # Delivery report request\n    dlr_url=\"https://webhook-test.com/273e777973dc8334bbaa2ef63f3d9cf6\",  # URL for delivery reports\n)\n\nprint(response)\n```\n\n### Batch Sending\n\nFor sending messages to multiple recipients at once, you can use batch sending:\n\n```python\nfrom plasgate.rest import Client\n\n# Initialize client with your API credentials\nprivate = \"PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nsecret = \"PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n\nclient = Client(private, secret, batch_sending=True)\n\n# Send batch messages\nresponse = client.messages.create(\n    messages=[\n        {\"to\": [\"85581848677\", \"855972432661\"], \"content\": \"Test plasgate client\"}\n    ],\n    globals={\n        \"sender\": \"PlasGate\",  # Sender ID for all messages\n        \"dlr\": \"yes\",           # Request delivery reports\n        \"dlr_level\": 3,         # Level of detail for delivery reports\n        \"dlr_url\": \"https://webhook-test.com/273e777973dc8334bbaa2ef63f3d9cf6\",  # URL for delivery reports\n    },\n)\n\nprint(response)\n```\n\n### Twilio Migration\n\nIf you are migrating from Twilio, you can use the same structure with Plasgate:\n\n```python\nfrom plasgate.rest import Client\n\n# Initialize client with your API credentials\naccount_sid = \"PLASGATE_PRIVATE_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nauth_token = \"PLASGATE_SECRET_KEY_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n\nclient = Client(account_sid, auth_token)\n\n# Send a message using the Twilio-like syntax\nmessage = client.messages.create(\n    to=\"+855972432661\",  # Recipient's number\n    from_=\"PlasGate\",    # Your sender ID\n    body=\"Hello from Python!\"  # Message body\n)\n\nprint(message)\n```\n\n## Additional Considerations\n\n- **Error Handling**: Ensure you implement error handling to manage any issues with sending messages (e.g., invalid numbers, network errors).\n- **Rate Limiting**: Be aware of any rate limits imposed by Plasgate to avoid disruptions in service.\n- **Secure Your Keys**: Always keep your API keys confidential and do not expose them in public repositories.\n\nFor more information and detailed documentation, please refer to the official Plasgate API documentation.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Plasgate SMS API client",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/plasgateCoLTD/python"
    },
    "split_keywords": [
        "plasgate",
        " sms-api",
        " plasgate-otp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b9deab770bd8ce876834a1fe5cfd8d9bf83495ce0bc5be1a780d119c5a65f3c",
                "md5": "6728f17675fcbe250ac06a4e573c57e2",
                "sha256": "bf07c27538a83faaa57e43364801933ed5f245f294073298ee20a5b18514f1b6"
            },
            "downloads": -1,
            "filename": "plasgate_sms-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6728f17675fcbe250ac06a4e573c57e2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.0",
            "size": 7117,
            "upload_time": "2024-10-18T09:10:59",
            "upload_time_iso_8601": "2024-10-18T09:10:59.252251Z",
            "url": "https://files.pythonhosted.org/packages/7b/9d/eab770bd8ce876834a1fe5cfd8d9bf83495ce0bc5be1a780d119c5a65f3c/plasgate_sms-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc7734f91df966b7e2e04680e0dc8b727f68bf2879d7dbfbb311be8a0ebb3f3e",
                "md5": "7afa614ab66ef5014afb138ecfe9c0a9",
                "sha256": "4cee316a749adeb09320576db918133b87e1521fa269f49e640dcfc8865f5864"
            },
            "downloads": -1,
            "filename": "plasgate-sms-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7afa614ab66ef5014afb138ecfe9c0a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.0",
            "size": 6112,
            "upload_time": "2024-10-18T09:11:00",
            "upload_time_iso_8601": "2024-10-18T09:11:00.711042Z",
            "url": "https://files.pythonhosted.org/packages/cc/77/34f91df966b7e2e04680e0dc8b727f68bf2879d7dbfbb311be8a0ebb3f3e/plasgate-sms-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-18 09:11:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plasgateCoLTD",
    "github_project": "python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "plasgate-sms"
}
        
Elapsed time: 0.42919s