def create_session():
    try:
        api_client = MessageBusAPIClient(api_key, uri=uri)
        results = api_client.create_session(channel=channel,
                                            session_name=session_name)
    except MessageBusResponseError, error:
        raise error
Beispiel #2
0
def send_emails():
    try:
        api_client = MessageBusAPIClient(api_key, uri=uri)
        message_jane = {
            'to_email': '*****@*****.**',
            'to_name': 'Jane Smith',
            'from_email': '*****@*****.**',
            'from_name': 'Example Corporation',
            'subject': 'Single Message Sample for Jane Smith',
            'return_path': '*****@*****.**',
            'plaintext_body': 'This message to Jane Smith is a test sent by the Python Message Bus client library.',
            'html_body': '<html><body>This message to Jane Smith is a test sent by the Python Message Bus sdk.</body></html>',
            'session_key': 'DEFAULT',
        }

        message_john = {
            'to_email': '*****@*****.**',
            'to_name': 'John Doe',
            'from_email': '*****@*****.**',
            'from_name': 'Example Corporation',
            'subject': 'Single Message Sample for John Doe',
            'return_path': '*****@*****.**',
            'plaintext_body': 'This message to John Doe is a test sent by the Python Message Bus client library.',
            'html_body': '<html><body>This message to John Doe is a test sent by the Python Message Bus sdk.</body></html>',
            'session_key': 'DEFAULT',
        }
        results = api_client.send_messages([message_jane, message_john])
    except MessageBusResponseError, error:
        print error.message
def get_sessions():
    try:
        api_client = MessageBusAPIClient(api_key, uri=uri)
        results = api_client.get_channel_sessions(channel=channel)
    except MessageBusResponseError, error:
        raise error