Skip to main content

nimbasms-python

A Python module for communicating with Nimba SMS API.

Installation

pip install nimbasms

Usage

import logging
from nimbasms import Client

ACCOUNT_SID = 'XXXX'
AUTH_TOKEN = 'XXXX'
client = Client(ACCOUNT_SID, AUTH_TOKEN)
logging.basicConfig()
logging.basicConfig(filename='./log.txt') # or loging in file
client.http_client.logger.setLevel(logging.INFO)

# Get your account balance
response = client.accounts.get()
if response.ok:
    my_account = response.data
    print('My Account balance : {}'.format(my_account['balance']))


# Get groups
response = client.groups.list()
if response.ok:
    all_groups = response.data
    print('There are {} groupes'.format(len(all_messages)))


# Get Sendernames
response = client.sendernames.list()
if response.ok:
    all_sendernames = response.data
    for item in all_sendernames:
        print(item)


# Get Contact
response = client.contacts.list()
if response.ok:
    all_contacts = response.data
    for item in all_contacts:
        print(item)


# Create Contact
# This contact will be added to the default contact list
response = client.contacts.create(numero='224XXXXXXXXX')
if response.ok:
    contact = response.data
# Create with groups and name - name and groups are optional.
response = client.contacts.create(numero='224XXXXXXXXX', name='Foo', groups=['API', 'Facebook Client'])
if response.ok:
    contact = response.data


# Get All messages
response = client.messages.list()
if response.ok:
    all_messages = response.data
    print('There are {} messages in your account.'.format(len(all_messages)))

# Get only last 10 messages
response = client.messages.list(limit=10)
if response.ok:
    some_messages = some_messages.data
    print('Here are the last 10 messages in your account:')
    for m in some_messages:
        print(m)

# send message...
print('Sending a message...')
response = client.messages.create(to=['XXXX'],
            sender_name='YYYY', message='Hi Nimba!')
if response.ok:
    print('message response : {}'.format(response.data))


# Retrieve message
response = client.messages.retrieve(messageid='XXXXXXXXXXXXXXXXXXXXX')
if response.ok:
    print("Message retrieve : {}".format(response.data))

Credit

Nimba SMS

Download files

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

Source Distribution

nimbasms-1.0.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

nimbasms-1.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file nimbasms-1.0.2.tar.gz.

File metadata

  • Download URL: nimbasms-1.0.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for nimbasms-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3df3c71315a5baf46ecb8aa98f52ac1a056cd0e848950dc96390a0bd2a29c57b
MD5 388dc06f30ddb0d59cb91999537660a9
BLAKE2b-256 91ffc3cdb884c0c6e8e4e96e5ad4411b5cb7d78d16e6a07c1ff1bb36d60fbfb3

See more details on using hashes here.

File details

Details for the file nimbasms-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: nimbasms-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for nimbasms-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a31398603a853da3b2606a271f30a3a25b32929550204331b17706f488b323dd
MD5 e629edbca71a3ee2c29c777d135e7017
BLAKE2b-256 c1fdb7440013b169e0b03593e952b192530da81c74c4595dc69eb4705d1800ef

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

2 files

0.0.1

2 files

Supported by

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