Python client for SMSAPI contacts rest API.
Project description
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: smsapi-contacts-python
=============
Client for SMSAPI contacts rest api.
## COMPATIBILITY:
Compatible with Python 2.6+, 2.7+, 3.+.
## REQUIREMENTS:
requests
## INSTALLATION:
If You have pip installed:
sudo pip install smsapi-contacts
else You can install manually:
git clone https://github.com/smsapi/smsapi-contacts-python-client.git
cd smsapi-contacts-python
python setup.py install
## USAGE:
```python
from contacts.api import ContactsApi
api = ContactsApi(username=api_username, password=api_password)
```
#### Contact management
```python
contact = api.create_contact(
first_name='Jon',
last_name='Doe',
idx='id for Your use',
phone_number=123123123,
email='jondoe@somedomain.com'
birthday_date='1970-01-01',
gender='{male|female|undefined}',
city='some_city',
email='jondoe@somedomain.com',
source='some_contact_source',
description='Jon Doe')
contact = api.update_contact(contact_id=1, description='new_description')
contacts = api.list_contacts()
contact = api.get_contact(contact_id=1)
groups = api.list_contact_groups(contact_id=1)
contact = api.bind_contact_to_group(contact_id=1, group_id=1)
api.delete_contact(contact_id=1)
```
#### Group management
```python
group = api.create_group(name='group_name', description='group_description')
groups = api.list_groups()
group = api.get_group(group_id=1)
group = api.update_group(group_id=1, name='new_name')
api.delete_group(group_id=1)
permissions = api.list_group_permissions(group_id=1)
permission = api.create_group_permission(
group_id=1
read=True,
write=False,
send=True)
permissions = api.list_user_group_permissions(group_id=1, username='some_username')
api.delete_user_group_permission(group_id=1, username='some_username')
permission = api.update_user_group_permission(group_id=1, username='some_username', read=False)
api.unpin_contact_from_group(group_id=1, contact_id=1)
contact = api.contact_is_in_group(group_id=1, contact_id=1)
```
#### Custom field management
```python
fields = api.list_custom_fields()
field = api.create_custom_field(name='some_field_name', type='{TEXT|DATE|EMAIL|NUMBER|PHONENUMBER|}')
field = api.update_custom_field(field_id='1', name='new_field_name')
delete_custom_field(field_id=1)
```
#### Error handling
```python
from smsapi.exception import ContactsApiError
try:
contact = api.create_contact(phone_number=123123)
except ContactsApiError as e:
print(e.message, e.code, e.type)
```
## LICENSE
[Apache 2.0 License](https://github.com/smsapi/smsapi-contacts-python/blob/master/LICENSE)
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: Apache 2.0
Classifier: Topic :: Software Development :: Libraries :: Python ModulesProgramming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: smsapi-contacts-python
=============
Client for SMSAPI contacts rest api.
## COMPATIBILITY:
Compatible with Python 2.6+, 2.7+, 3.+.
## REQUIREMENTS:
requests
## INSTALLATION:
If You have pip installed:
sudo pip install smsapi-contacts
else You can install manually:
git clone https://github.com/smsapi/smsapi-contacts-python-client.git
cd smsapi-contacts-python
python setup.py install
## USAGE:
```python
from contacts.api import ContactsApi
api = ContactsApi(username=api_username, password=api_password)
```
#### Contact management
```python
contact = api.create_contact(
first_name='Jon',
last_name='Doe',
idx='id for Your use',
phone_number=123123123,
email='jondoe@somedomain.com'
birthday_date='1970-01-01',
gender='{male|female|undefined}',
city='some_city',
email='jondoe@somedomain.com',
source='some_contact_source',
description='Jon Doe')
contact = api.update_contact(contact_id=1, description='new_description')
contacts = api.list_contacts()
contact = api.get_contact(contact_id=1)
groups = api.list_contact_groups(contact_id=1)
contact = api.bind_contact_to_group(contact_id=1, group_id=1)
api.delete_contact(contact_id=1)
```
#### Group management
```python
group = api.create_group(name='group_name', description='group_description')
groups = api.list_groups()
group = api.get_group(group_id=1)
group = api.update_group(group_id=1, name='new_name')
api.delete_group(group_id=1)
permissions = api.list_group_permissions(group_id=1)
permission = api.create_group_permission(
group_id=1
read=True,
write=False,
send=True)
permissions = api.list_user_group_permissions(group_id=1, username='some_username')
api.delete_user_group_permission(group_id=1, username='some_username')
permission = api.update_user_group_permission(group_id=1, username='some_username', read=False)
api.unpin_contact_from_group(group_id=1, contact_id=1)
contact = api.contact_is_in_group(group_id=1, contact_id=1)
```
#### Custom field management
```python
fields = api.list_custom_fields()
field = api.create_custom_field(name='some_field_name', type='{TEXT|DATE|EMAIL|NUMBER|PHONENUMBER|}')
field = api.update_custom_field(field_id='1', name='new_field_name')
delete_custom_field(field_id=1)
```
#### Error handling
```python
from smsapi.exception import ContactsApiError
try:
contact = api.create_contact(phone_number=123123)
except ContactsApiError as e:
print(e.message, e.code, e.type)
```
## LICENSE
[Apache 2.0 License](https://github.com/smsapi/smsapi-contacts-python/blob/master/LICENSE)
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: Apache 2.0
Classifier: Topic :: Software Development :: Libraries :: Python ModulesProgramming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
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
smsapi-contacts-1.0.1.tar.gz
(7.2 kB
view details)
Built Distribution
File details
Details for the file smsapi-contacts-1.0.1.tar.gz
.
File metadata
- Download URL: smsapi-contacts-1.0.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722473c10a9ecff6c83a22dd57d9f1236c29519565ed7b896f969a74643357a0 |
|
MD5 | 64e2fa2eb9194cb7306b21f34eb968e5 |
|
BLAKE2b-256 | d644e8193a727c4ae440682c919a6b640f0e22790ad946bd7d699ec78e1b12b9 |
File details
Details for the file smsapi_contacts-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: smsapi_contacts-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97a3dcd5b142ae56ed62de9ec5fc8576973f57bc2243e40c2ca85c203d99992 |
|
MD5 | 3d540881b82c9f40aa9ae7aa209ea5b6 |
|
BLAKE2b-256 | d311b8a70ee95671b4c8258099de687ca8456d5d4cf579d01da14355250fda25 |