Recently the implementation of the smsgateway.me for sending/receiving SMS's has changed and broke the library that I was using, so I decided to make my own version
pip install smsgateway-v4
Get your API Token in the settings page
Before starting is necessary to create the client with the token as parameter
from smsgateway import SMSGateway, Message
client = SMSGateway('your-api-token-here-keep-it-secret')
Sending messages requires the device id, so its necessary to get it
devices = client.search_devices()
if len(devices['results']) == 0:
raise Exception('No device found on your account')
did = devices['results'][0]['id']
Its possible to pass a filter object as parameter as specified on the docs
message1 = Message('12345678', 'Message 1 body', did)
message2 = Message('12345678', 'Message 2 body', did)
status = client.send_sms(message1, message2)
print(status)
I decided to implement only the endpoints that I need, but if you need anything else, please make a PR :)
Below what is already implemented and what's not:
- ✔️ Get devices information
- ✔️ Search for devices
- ✔️ Sending a message
- ✔️ Canceling a message
- ✔️ Getting a message information
- ✔️ Searching for messages
- ❌ Creating a contact
- ❌ Updating an existing contact
- ❌ Adding a phone to an existing contact
- ❌ Remove a phone from an existing contact
- ❌ Getting a contact information
- ❌ Searching for contacts
- ❌ Creating a callback
- ❌ Updating an existing callback
- ❌ Getting callback information
- ❌ Searching for callbacks
TBD
PR's are welcome