| |
- __builtin__.object
-
- Client
- JsonWrapper
- Message
-
- BinaryMessage
- TextMessage
- Response
- exceptions.Exception(exceptions.BaseException)
-
- ApiException
- AuthorizationFailedException
- HttpConnectionException
- ParameterValidationException
- UnknownResponseException
class BinaryMessage(Message) |
|
Binary Message object for sending binary segments over Client.
Compared to the TextMessage class, a BinaryMessage contains its message content as a list of message segments.
Therefore when sending a BinaryMessage 'maxSmsPerMessage' parameter is not supported
Example for creating binary message object:
message = WebSmsComToolkit.BinaryMessage([4367612345678L, 43676123456789L], ["BQAD/AIBWnVzYW1tZW4=","BQAD/AICZ2Vmw7xndC4="], True) |
|
- Method resolution order:
- BinaryMessage
- Message
- __builtin__.object
Methods defined here:
- __init__(self, recipients, message_content, user_data_header_present=False)
- Constructor
Params: - recipients : list of long
- message_content : list of string/unicode (containing binary encoded with base64)
- user_data_header_present: bool
Throws: ParameterValidationException
- get_message_content(self)
- Get message_content
Returns: messageContent (list of string/unicode) set for this message obejct
- get_user_data_header_present(self)
- Get user_data_header_present
Returns: userDataHeaderPresent set for this Message object (bool)
- set_message_content(self, message_content)
- Set message_content
Params: - message_content (list of string/unicode containing base64 encoded binary)
e.G.: message.message_content(['BQAD/AIBWnVzYW1tZW4=','BQAD/AICZ2Vmw7xndC4=']);
Returns: messageContent set for this Message object
Throws: ParameterValidationException
- set_user_data_header_present(self, userDataHeaderPresent)
- Set user_data_header_present(userDataHeaderPresent)
Params: - userDataHeaderPresent: (bool)
Set it to True when the binary that was base64 encoded contained user a data header
Returns: userDataHeaderPresent set for this Message object
Throws: ParameterValidationException
Data descriptors defined here:
- message_content
- Get message_content
Returns: messageContent (list of string/unicode) set for this message obejct
- user_data_header_present
- Get user_data_header_present
Returns: userDataHeaderPresent set for this Message object (bool)
Methods inherited from Message:
- check_recipient_address_list(self, recipientAddressList)
- Used internally to check validity of recipient_address_list (list of long)
- data(self)
- Read message data()
Returns: dict representation of Message object (only set values)
- get_client_message_id(self)
- Get client_message_id
Returns: clientMessaegId set for this Message object
- get_notification_callback_url(self)
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- get_priority(self)
- Get priority
Returns: priority set for this Message object
- get_recipient_address_list(self)
- Get recipient_address_list (list of long) from message
Returns: list
- get_send_as_flash_sms(self)
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- get_sender_address(self)
- Get sender_address from message
Returns: senderAddress of Message object
- get_sender_address_type(self)
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
- set_client_message_id(self, clientMessageId)
- Set client_message_id(string)
Params: - clientMessageId: string with message id for this message.
This message id is returned with the response to the send request
and used for notifications
Returns: clientMessaegId set for this Message object
Throws: ParameterValidationException
- set_notification_callback_url(self, notificationCallbackUrl)
- Set notification_callback_url
Params: - notificationCallbackUrl: string of notification callback URI
customers URI that listens for delivery report notifications
or replies for this message
Returns: set notificationCallbackUrl of Message object
Throws: ParameterValidationException
- set_priority(self, priority)
- Set priority(priority)
Params: - priority: message priority as integer (1 to 9)
(level height must be supported by account settings)
Returns: priority set for this Message object
Throws: ParameterValidationException
- set_recipient_address_list(self, recipients)
- Set recipient_address_list(recipients)
Params: - recipients: (list of long containing full international MSISDNs) e.G.: [4367612345678L, long("4912345678")]
Throws: - ParameterValidationException
- set_send_as_flash_sms(self, sendAsFlashSms)
- Set send_as_flash_sms(bool)
Params: boolean: True, False or None
Returns: set sendAsFlashSms of Message object
- set_sender_address(self, senderAddress)
- Set sender_address
available sender address is dependend on user account
Params: - senderAddress: string of sender address (msisdn or alphanumeric)
Returns: senderAddress of Message object
Throws: ParameterValidationException
- set_sender_address_type(self, senderAddressType)
- Set sender_address_type
available one of: ('national', 'international', 'alphanumeric' or 'shortcode')
Returns: sender_adress_type set
Throws: ParameterValidationException
Data descriptors inherited from Message:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- client_message_id
- Get client_message_id
Returns: clientMessaegId set for this Message object
- notification_callback_url
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- priority
- Get priority
Returns: priority set for this Message object
- recipient_address_list
- Get recipient_address_list (list of long) from message
Returns: list
- send_as_flash_sms
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- sender_address
- Get sender_address from message
Returns: senderAddress of Message object
- sender_address_type
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
Data and other attributes inherited from Message:
- availableSenderAddressType = ['national', 'international', 'alphanumeric', 'shortcode']
|
class Client(__builtin__.object) |
|
Client used to send sms messages (TextMessage or BinaryMessage objects)
Create once and send messages with its send() method
Example:
client = WebSmsComToolkit.Client('http://api.websms.com/', username, password) |
|
Methods defined here:
- __init__(self, url_base, username, password)
- Constructor requiring base url, username and password
You only need to create the client once.
- get_timeout(self)
- Get timeout of urllib2 client
Returns: seconds (int)
- get_verbose(self)
- Get verbose mode of Client
Returns: verbose mode (bool)
- send(self, message_object=None, max_sms_per_message=None, is_test=None)
- Send message to websms.com API
Params: - message_object : Must be instanceof TextMessage or BinaryMessage
- max_sms_per_message : int (1-255) )limiting the maximum set sms per message (For TextMessage. Set it to None for BinaryMessage)
- is_test : bool indicating if message is a test message (False is default).
Test Messages will not be sent, but generate a successful response.
Returns: - response of type Response
Throws: - ParameterValidationException
- AuthorizationFailedException
- ApiException
- HttpConnectionException
- Exception
- set_timeout(self, seconds)
- Set timeout of urllib2 (default is 10)
!ATTENTION!
Will only work for python 2.6+, The optional timeout parameter specifies a timeout in
seconds for blocking operations like the connection attempt.
For python <2.6, the global default timeout setting can be used,
but are not affected by this timeout
Params: - seconds (int)
Returns: seconds set
- set_verbose(self, bool_verbose)
- Set verbose mode of Client
Params: - bool_verbose (boolean)
Returns: verbose mode set
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- timeout
- Get timeout of urllib2 client
Returns: seconds (int)
- verbose
- verbose mode
Data and other attributes defined here:
- VERSION = '1.0.0'
|
class JsonWrapper(__builtin__.object) |
|
This class can be used to offer a custom 'loads' and 'dumps' function for JSON by overwriting it |
|
Methods defined here:
- __init__(self)
- dumps(self, param)
- loads(self, param)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Message(__builtin__.object) |
|
Abstract Base Message object
inherited by TextMessage and BinaryMessage |
|
Methods defined here:
- __init__(self, recipients)
- check_recipient_address_list(self, recipientAddressList)
- Used internally to check validity of recipient_address_list (list of long)
- data(self)
- Read message data()
Returns: dict representation of Message object (only set values)
- get_client_message_id(self)
- Get client_message_id
Returns: clientMessaegId set for this Message object
- get_notification_callback_url(self)
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- get_priority(self)
- Get priority
Returns: priority set for this Message object
- get_recipient_address_list(self)
- Get recipient_address_list (list of long) from message
Returns: list
- get_send_as_flash_sms(self)
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- get_sender_address(self)
- Get sender_address from message
Returns: senderAddress of Message object
- get_sender_address_type(self)
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
- set_client_message_id(self, clientMessageId)
- Set client_message_id(string)
Params: - clientMessageId: string with message id for this message.
This message id is returned with the response to the send request
and used for notifications
Returns: clientMessaegId set for this Message object
Throws: ParameterValidationException
- set_notification_callback_url(self, notificationCallbackUrl)
- Set notification_callback_url
Params: - notificationCallbackUrl: string of notification callback URI
customers URI that listens for delivery report notifications
or replies for this message
Returns: set notificationCallbackUrl of Message object
Throws: ParameterValidationException
- set_priority(self, priority)
- Set priority(priority)
Params: - priority: message priority as integer (1 to 9)
(level height must be supported by account settings)
Returns: priority set for this Message object
Throws: ParameterValidationException
- set_recipient_address_list(self, recipients)
- Set recipient_address_list(recipients)
Params: - recipients: (list of long containing full international MSISDNs) e.G.: [4367612345678L, long("4912345678")]
Throws: - ParameterValidationException
- set_send_as_flash_sms(self, sendAsFlashSms)
- Set send_as_flash_sms(bool)
Params: boolean: True, False or None
Returns: set sendAsFlashSms of Message object
- set_sender_address(self, senderAddress)
- Set sender_address
available sender address is dependend on user account
Params: - senderAddress: string of sender address (msisdn or alphanumeric)
Returns: senderAddress of Message object
Throws: ParameterValidationException
- set_sender_address_type(self, senderAddressType)
- Set sender_address_type
available one of: ('national', 'international', 'alphanumeric' or 'shortcode')
Returns: sender_adress_type set
Throws: ParameterValidationException
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- client_message_id
- Get client_message_id
Returns: clientMessaegId set for this Message object
- notification_callback_url
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- priority
- Get priority
Returns: priority set for this Message object
- recipient_address_list
- Get recipient_address_list (list of long) from message
Returns: list
- send_as_flash_sms
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- sender_address
- Get sender_address from message
Returns: senderAddress of Message object
- sender_address_type
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
Data and other attributes defined here:
- availableSenderAddressType = ['national', 'international', 'alphanumeric', 'shortcode']
|
class Response(__builtin__.object) |
|
Response object returned by Client
Offers properties:
- rawContent : response content of send request (unicode)
- statusCode : status code returned from API (int)
- statusMessage : description of status code (string)
- transferId : the id of the message transfer to the API (unicode)
- clientMessageId : the message id (unicode) |
|
Methods defined here:
- __init__(self, raw_content, statusCode, statusMessage, transferId, clientMessageId=None)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class TextMessage(Message) |
|
Text Message Class for sending utf8 text message over Client.
Compared to the BinaryMessage class, a TextMessage has one messageContent that will be sent as one or multiple sms.
The 'maxSmsPerMessage' parameter when sending the message limits the generated sms amount
Example for creating message object:
message = WebSmsComToolkit.TextMessage([4367612345678L,43676123456789L], u'Hallo Welt') |
|
- Method resolution order:
- TextMessage
- Message
- __builtin__.object
Methods defined here:
- __init__(self, recipients, message_content)
- Constructor
Params: - recipients : list of long
- message_content : unicode
Throws ParameterValidationException
- get_message_content(self)
- Get message_content
Returns: messageContent set for this Message object
- set_message_content(self, message_content)
- Set message_content(unicode)
Params: - message_content: unicode string
Returns: set messageContent of this Message object
Throws: ParameterValidationException
Data descriptors defined here:
- message_content
- Get message_content
Returns: messageContent set for this Message object
Methods inherited from Message:
- check_recipient_address_list(self, recipientAddressList)
- Used internally to check validity of recipient_address_list (list of long)
- data(self)
- Read message data()
Returns: dict representation of Message object (only set values)
- get_client_message_id(self)
- Get client_message_id
Returns: clientMessaegId set for this Message object
- get_notification_callback_url(self)
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- get_priority(self)
- Get priority
Returns: priority set for this Message object
- get_recipient_address_list(self)
- Get recipient_address_list (list of long) from message
Returns: list
- get_send_as_flash_sms(self)
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- get_sender_address(self)
- Get sender_address from message
Returns: senderAddress of Message object
- get_sender_address_type(self)
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
- set_client_message_id(self, clientMessageId)
- Set client_message_id(string)
Params: - clientMessageId: string with message id for this message.
This message id is returned with the response to the send request
and used for notifications
Returns: clientMessaegId set for this Message object
Throws: ParameterValidationException
- set_notification_callback_url(self, notificationCallbackUrl)
- Set notification_callback_url
Params: - notificationCallbackUrl: string of notification callback URI
customers URI that listens for delivery report notifications
or replies for this message
Returns: set notificationCallbackUrl of Message object
Throws: ParameterValidationException
- set_priority(self, priority)
- Set priority(priority)
Params: - priority: message priority as integer (1 to 9)
(level height must be supported by account settings)
Returns: priority set for this Message object
Throws: ParameterValidationException
- set_recipient_address_list(self, recipients)
- Set recipient_address_list(recipients)
Params: - recipients: (list of long containing full international MSISDNs) e.G.: [4367612345678L, long("4912345678")]
Throws: - ParameterValidationException
- set_send_as_flash_sms(self, sendAsFlashSms)
- Set send_as_flash_sms(bool)
Params: boolean: True, False or None
Returns: set sendAsFlashSms of Message object
- set_sender_address(self, senderAddress)
- Set sender_address
available sender address is dependend on user account
Params: - senderAddress: string of sender address (msisdn or alphanumeric)
Returns: senderAddress of Message object
Throws: ParameterValidationException
- set_sender_address_type(self, senderAddressType)
- Set sender_address_type
available one of: ('national', 'international', 'alphanumeric' or 'shortcode')
Returns: sender_adress_type set
Throws: ParameterValidationException
Data descriptors inherited from Message:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- client_message_id
- Get client_message_id
Returns: clientMessaegId set for this Message object
- notification_callback_url
- Get notification_callback_url
Returns: set notificationCallbackUrl of Message object
- priority
- Get priority
Returns: priority set for this Message object
- recipient_address_list
- Get recipient_address_list (list of long) from message
Returns: list
- send_as_flash_sms
- Get send_as_flash_sms
returns: set sendAsFlashSms of Message object
- sender_address
- Get sender_address from message
Returns: senderAddress of Message object
- sender_address_type
- Get sender_address_type
Returns: a string of ['national', 'international', 'alphanumeric' or 'shortcode']
Data and other attributes inherited from Message:
- availableSenderAddressType = ['national', 'international', 'alphanumeric', 'shortcode']
|
|