-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project formatted to python package.
- Loading branch information
Michael Karpitsky
committed
Jul 25, 2013
1 parent
75ab3dc
commit 1634212
Showing
8 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*~ | ||
*.pyc | ||
build/* | ||
dist/* | ||
*/dist/* | ||
*.egg | ||
*.egg-info | ||
src/*.egg-info/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Copyright (c) 2013 Marco Londero <marco.londero@linux.it> | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
nexmomessage | ||
============ | ||
|
||
|
||
A Python wrapper for the [Nexmo API](https://www.nexmo.com/documentation/api/index.html). | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
$ pip install -e git+https://github.com/marcuz/libpynexmo.git#egg=nexmomessage | ||
|
||
|
||
Quick start (sending a message) | ||
------------------------------- | ||
|
||
First you need to load up the package and construct a dictionary | ||
with your API credentials and message, like this: | ||
|
||
```python | ||
from nexmomessage import NexmoMessage | ||
|
||
msg = { | ||
'reqtype': 'json', | ||
'api_key': YOUR_API_KEY, | ||
'api_secret': YOUR_API_SECRET_KEY, | ||
'from': YOUR_PHONE_NUMBER, | ||
'to': DESTINATION_PHONE_NUMBER, | ||
'text': 'Hello world!' | ||
} | ||
sms = NexmoMessage(msg) | ||
sms.set_text_info(msg['text']) | ||
``` | ||
|
||
Then you have a choice. For a "fire and forget" approach to sending a message, | ||
use the `send_message` method, like this: | ||
|
||
```python | ||
sms.send_request() | ||
``` | ||
|
||
This method call returns the message data if the message was sent successfully, | ||
or return Flase if there was an error. | ||
|
||
```python | ||
response = sms.send_request() | ||
|
||
if response: | ||
# do something with response data | ||
else: | ||
# handle the error | ||
``` | ||
|
||
|
||
Troubleshooting | ||
--------------- | ||
|
||
Remember that phone numbers should be specified in international format. | ||
|
||
The Nexmo documentation contains a [list of error codes](http://nexmo.com/documentation/index.html#response_code) | ||
which may be useful if you have problems sending a message. | ||
|
||
Please report all bugs/issues via the GitHub issue tracker. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from nexmo import NexmoMessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python | ||
|
||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
|
||
VERSION = '0.1.0' | ||
|
||
setup( | ||
name='nexmomessage', | ||
version=VERSION, | ||
description='A Python wrapper for the Nexmo API', | ||
author='Marco Londero', | ||
author_email='marco.londero@linux.it', | ||
license='BSD', | ||
url='https://github.com/marcuz/libpynexmo', | ||
keywords=['Nexmo', 'Python'], | ||
packages=['nexmomessage'], | ||
) |