Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nexmo

A Python wrapper for the Nexmo API.

Installation

$ pip install nexmo

Sending a message

Construct a nexmo.Client object with your API credentials and call the send_message method to send a message. For example:

import nexmo

client = nexmo.Client(key='YOUR-API-KEY', secret='YOUR-API-SECRET')

client.send_message({'from': 'Python', 'to': 'YOUR-NUMBER', 'text': 'Hello world'})

The Nexmo documentation contains a list of error codes which may be useful for debugging errors. Remember that phone numbers should be specified in international format, and other country specific restrictions may apply (e.g. US messages must originate from either a pre-approved long number or short code).

Production environment variables

Best practice for storing credentials for external services in production is to use environment variables, as described by 12factor.net/config. The nexmo.Client constructor defaults to extracting the API credentials it needs from the NEXMO_API_KEY and NEXMO_API_SECRET environment variables if the key/secret arguments were not specified explicitly.

About

Nexmo REST API client for Python. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages