Skip to main content

The MessageMedia Signature Key API provides a number of endpoints for managing key used to sign each unique request to ensure security and the requests can't (easily) be spoofed. This is similar to using HMAC in your outbound messaging (rather than HTTP Basic).

Project description

# MessageMedia Signature Key Management Python SDK
[![Travis Build Status](https://api.travis-ci.org/messagemedia/webhooks-python-sdk.svg?branch=master)](https://travis-ci.org/messagemedia/webhooks-python-sdk)
[![PyPI](https://badge.fury.io/py/messagemedia-webhooks-sdk.svg)](https://pypi.python.org/pypi/messagemedia-webhooks-sdk)

The MessageMedia Signature Key API provides a number of endpoints for managing key used to sign each unique request to ensure security and the requests can't (easily) be spoofed. This is similar to using HMAC in your outbound messaging (rather than HTTP Basic).

## ⭐️ Install via PIP
Run the following command to install the SDK via pip:
`pip install messagemedia-signingkeys-sdk`

## 🎬 Get Started
It's easy to get started. Simply enter the API Key and secret you obtained from the [MessageMedia Developers Portal](https://developers.messagemedia.com) into the code snippet below.

### 🚀 Create a signature key
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

content_type = 'Content-Type'
accept = 'Accept'
body_value = '''{
"digest": "SHA224",
"cipher": "RSA"
}'''

body = json.loads(body_value)

result = signature_key_management_controller.create_signature_key(content_type, accept, body)

```

### 📥 Get signature key details
You can get a key_id by looking at the id of the signature key created from the response of the above example.
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

key_id = 'key_id'
content_type = 'Content-Type'
accept = 'Accept'

result = signature_key_management_controller.get_signature_key_detail(key_id, content_type, accept)

```

### 📥 Get signature keys list
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

content_type = 'Content-Type'
accept = 'Accept'
page = 'page'
page_size = 'page_size'

result = signature_key_management_controller.get_signature_key_list(content_type, accept, page, page_size)

```

### ❌ Delete signature key
You can get the key_id by looking at the ids of the signature keys returned from the response of the `Get signature keys list` example.
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

key_id = 'key_id'
content_type = 'Content-Type'
accept = 'Accept'

signature_key_management_controller.delete_signature_key(key_id, content_type, accept)

```

### ☑️ Enable a signature key
You can get the key_id by looking at the ids of the signature keys returned from the response of the `Get signature keys list` example.
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

content_type = 'Content-Type'
accept = 'Accept'
body = EnableSignatureKeyRequest()

result = signature_key_management_controller.update_enable_signature_key(content_type, accept, body)

```

### 📥 Get enabled signature key
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

content_type = 'Content-Type'
accept = 'Accept'

result = signature_key_management_controller.get_enabled_signature_key(content_type, accept)

```

### 🚫 Disable an enabled signature key
```python
from message_media_signing_keys.message_media_signing_keys_client import MessageMediaSigningKeysClient

# Configuration parameters and credentials
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication

client = MessageMediaSigningKeysClient(basic_auth_user_name, basic_auth_password)

signature_key_management_controller = client.signature_key_management

content_type = 'Content-Type'
accept = 'Accept'

signature_key_management_controller.delete_disable_the_current_enabled_signature_key(content_type, accept)

```

## 📕 Documentation
Check out the [full API documentation](DOCUMENTATION.md) for more detailed information.

## 😕 Need help?
Please contact developer support at developers@messagemedia.com or check out the developer portal at [developers.messagemedia.com](https://developers.messagemedia.com/)

## 📃 License
Apache License. See the [LICENSE](LICENSE) file.

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

messagemedia_signingkeys_sdk-1.0.0.tar.gz (21.6 kB view details)

Uploaded Source

File details

Details for the file messagemedia_signingkeys_sdk-1.0.0.tar.gz.

File metadata

File hashes

Hashes for messagemedia_signingkeys_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a6ae70206f104d95cf914be2d1dcc70bc8cfc5ce79b0e34a892041c0a8167acb
MD5 f0a69e139fdb6ba7fc4b423d93a82115
BLAKE2b-256 eb8b758a4cb922629f43033bc35b1a6757573c2707f1e3c46c09e52095cfa089

See more details on using hashes here.

Supported by

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