Code Monkey home page Code Monkey logo

smsgateway's Introduction

SMSGateway.me Client for API v4

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

Usage

Installation

pip install smsgateway-v4

Token

Get your API Token in the settings page

Client initalization

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')

Device lookup

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

Sending messages

message1 = Message('12345678', 'Message 1 body', did)
message2 = Message('12345678', 'Message 2 body', did)
status = client.send_sms(message1, message2)
print(status)

Support

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:

Devices

  • ✔️ Get devices information
  • ✔️ Search for devices

Messages

  • ✔️ Sending a message
  • ✔️ Canceling a message
  • ✔️ Getting a message information
  • ✔️ Searching for messages

Contacts

  • ❌ 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

Callbacks

  • ❌ Creating a callback
  • ❌ Updating an existing callback
  • ❌ Getting callback information
  • ❌ Searching for callbacks

Tests

TBD

Contributing

PR's are welcome

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.