Skip to main content

An SDK that allows flexibility between CPaaS providers.

Project description

OpenCpaas Python SDK

OpenCpaas allows customers to switch between CpaaS providers without having to rewrite code.

Currently supports:

  • Bandwidth
  • Twilio

See our full documentation.

Requirements

Installation

pip install opencpaas

Getting Started

Client Initialization

Begin by initializing a new CpaaS client. This example uses the BandwidthClient for initialization. Specifics for each client can be found in each client's repository.

import opencpaas

auth = 	{
	'api_token': '789',
	'api_secret':'1011',
	'account_id': 'myaccount' ,
	'application_id': 'myapplication',
	'user': 'username',
	'pass': 'password',
	'site_id': '12345' 
	}

client = BandwidthClient(auth)

Each type of CpaaS client will require different authentications. Refer to our documentation for a complete list.

Send an SMS

message = client.send_sms(to="+12223334444"
                          from_="+12223334445"
                          text="Hello there!")

print(message['id'])

Send an MMS

message = client.send_mms(to="+12223334444"
                          from_="+12223334445"
                          text="Take a look at this!"
                          media_url="www.media.com/cute-cat")

print(message['id'])

Order a phone number

result = client.order_number(phone_number="+12223334444")

print(result['order_status'])

Order multiple phone numbers

result = client.order_numbers(area_code="410"
                              quantity=10)

print(result['order_status'])

Make an outgoing phone call

parameters = {
          'url':"http://mycallbackurl.com/123",
          'status_callback':"http://mystatuscallbackurl.com/123",
          'answer_url':"http://myanswerurl.com/123"
          }

call_id = client.create_call(to="+12223334444",
                             from_="+12223334445",
                             **parameters
                             )

print(call_id)

CpaaS clients require different callback urls. Please check our documentation for specific information on these urls.

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

opencpaas-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

opencpaas-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file opencpaas-0.0.1.tar.gz.

File metadata

  • Download URL: opencpaas-0.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for opencpaas-0.0.1.tar.gz
Algorithm Hash digest
SHA256 33ce049c4a5d315377d05f0944f9be242f65db04b4b6dfa106e1529df04d20b6
MD5 a071b0735db1561df678b0d82b8c2fe8
BLAKE2b-256 7109e96c953f16f1bb62c9beb09bf677dfc1881ac273bac0979ed523a337d825

See more details on using hashes here.

File details

Details for the file opencpaas-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: opencpaas-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for opencpaas-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59e52380e52a74bc71c83e3b2bf09bdb665d393fb40a6d20b79629feb3a28f71
MD5 fb8b496203012c5d9ae949b96091c849
BLAKE2b-256 3c817b9f5b2f38aa969c2c599d19fdd76b38781ada456f28ddcd0ef3f8747fbe

See more details on using hashes here.

Supported by

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