MessageBird's REST API for Python
=================================
This repository contains the open source Python client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/.
Requirements
------------
- [Sign up](https://www.messagebird.com/en/signup) for a free MessageBird account
- Create a new access key in the developers sections
- An application written in Python >3.8
Installation
------------
The easiest way to install the messagebird package is either via pip:
```
$ pip install messagebird
```
or manually by downloading the source and run the setup.py script:
```
$ python setup.py install
```
Examples
--------
We have put some self-explanatory examples in the [examples](https://github.com/messagebird/python-rest-api/tree/master/examples) directory, but here is a quick example on how to get started. Assuming the installation was successful, you can import the messagebird package like this:
```python
import messagebird
```
Then, create an instance of **messagebird.Client**:
```python
client = messagebird.Client('YOUR_ACCESS_KEY')
```
Now you can query the API for information or send a request. For example, if we want to request our balance information you'd do something like this:
```python
try:
# Fetch the Balance object.
balance = client.balance()
# Print the object information.
print('Your balance:\n')
print(' amount : %d' % balance.amount)
print(' type : %s' % balance.type)
print(' payment : %s\n' % balance.payment)
except messagebird.client.ErrorException as e:
print('Error:\n')
for error in e.errors:
print(' code : %d' % error.code)
print(' description : %s' % error.description)
print(' parameter : %s\n' % error.parameter)
```
This will give you something like:
```shell
$ python example.py
Your balance:
amount : 9
type : credits
payment : prepaid
```
Please see the other examples for a complete overview of all the available API calls.
To run examples with arguments, try:
```shell script
$ python ./examples/voice_create_webhook.py --accessKey accessKeyWhichNotExist --url https://example.com --title HELLO_WEBHOOK --token HELLO_TOKEN
```
Documentation
-------------
Complete documentation, instructions, and examples are available at:
[https://developers.messagebird.com/](https://developers.messagebird.com/).
License
-------
The MessageBird REST Client for Python is licensed under [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause). Copyright (c) 2022, MessageBird
Raw data
{
"_id": null,
"home_page": "https://github.com/messagebird/python-rest-api",
"name": "messagebird",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "messagebird, sms",
"author": "MessageBird",
"author_email": "support@messagebird.com",
"download_url": "https://files.pythonhosted.org/packages/50/61/c544af7fb0a61f83ca3cf0ec3933748a433cfec4e2ad65b4c57e1ee980e3/messagebird-2.2.0.tar.gz",
"platform": null,
"description": "MessageBird's REST API for Python\n=================================\nThis repository contains the open source Python client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/.\n\nRequirements\n------------\n- [Sign up](https://www.messagebird.com/en/signup) for a free MessageBird account\n- Create a new access key in the developers sections\n- An application written in Python >3.8\n\nInstallation\n------------\nThe easiest way to install the messagebird package is either via pip:\n\n```\n$ pip install messagebird\n```\n\nor manually by downloading the source and run the setup.py script:\n\n```\n$ python setup.py install\n```\n\nExamples\n--------\nWe have put some self-explanatory examples in the [examples](https://github.com/messagebird/python-rest-api/tree/master/examples) directory, but here is a quick example on how to get started. Assuming the installation was successful, you can import the messagebird package like this:\n\n```python\nimport messagebird\n```\n\nThen, create an instance of **messagebird.Client**:\n\n```python\nclient = messagebird.Client('YOUR_ACCESS_KEY')\n```\n\nNow you can query the API for information or send a request. For example, if we want to request our balance information you'd do something like this:\n\n```python\ntry:\n # Fetch the Balance object.\n balance = client.balance()\n\n # Print the object information.\n print('Your balance:\\n')\n print(' amount : %d' % balance.amount)\n print(' type : %s' % balance.type)\n print(' payment : %s\\n' % balance.payment)\n\nexcept messagebird.client.ErrorException as e:\n print('Error:\\n')\n\n for error in e.errors:\n print(' code : %d' % error.code)\n print(' description : %s' % error.description)\n print(' parameter : %s\\n' % error.parameter)\n\n```\n\nThis will give you something like:\n```shell\n$ python example.py\nYour balance:\n\n amount : 9 \n type : credits\n payment : prepaid\n```\n\nPlease see the other examples for a complete overview of all the available API calls.\n\nTo run examples with arguments, try:\n```shell script\n$ python ./examples/voice_create_webhook.py --accessKey accessKeyWhichNotExist --url https://example.com --title HELLO_WEBHOOK --token HELLO_TOKEN\n```\n\nDocumentation\n-------------\nComplete documentation, instructions, and examples are available at:\n[https://developers.messagebird.com/](https://developers.messagebird.com/).\n\nLicense\n-------\nThe MessageBird REST Client for Python is licensed under [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause). Copyright (c) 2022, MessageBird\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "MessageBird's REST API",
"version": "2.2.0",
"project_urls": {
"Homepage": "https://github.com/messagebird/python-rest-api"
},
"split_keywords": [
"messagebird",
" sms"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d1e9b41933644cdecd69f488bb98a9c7ed33267274d68642cbf08b4fb96415a6",
"md5": "81dc193dee9153dbb6f47f004687c1ce",
"sha256": "c92ce85044ad6c5c1d012129b32557767e1709492b8d4c93be037fed1b8e9db0"
},
"downloads": -1,
"filename": "messagebird-2.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "81dc193dee9153dbb6f47f004687c1ce",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 27970,
"upload_time": "2024-06-21T06:33:06",
"upload_time_iso_8601": "2024-06-21T06:33:06.444735Z",
"url": "https://files.pythonhosted.org/packages/d1/e9/b41933644cdecd69f488bb98a9c7ed33267274d68642cbf08b4fb96415a6/messagebird-2.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5061c544af7fb0a61f83ca3cf0ec3933748a433cfec4e2ad65b4c57e1ee980e3",
"md5": "88500fd04d0af1eef48c3b6cdfc63345",
"sha256": "71e80425f6027630b4c66d40c70f75ef8516c9d942e1b003f7d488c69e23ad79"
},
"downloads": -1,
"filename": "messagebird-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "88500fd04d0af1eef48c3b6cdfc63345",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30781,
"upload_time": "2024-06-21T06:33:08",
"upload_time_iso_8601": "2024-06-21T06:33:08.308874Z",
"url": "https://files.pythonhosted.org/packages/50/61/c544af7fb0a61f83ca3cf0ec3933748a433cfec4e2ad65b4c57e1ee980e3/messagebird-2.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-21 06:33:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "messagebird",
"github_project": "python-rest-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "messagebird"
}