Ejemplo n.º 1
0
def backend_handle_incoming(request, backend_name):
    """
    Call the backend's handle_incoming method.
    """
    if backend_name == 'debug':
        return backend_debug(request)
    b = get_backend(backend_name)
    if b is None:
        raise Http404
    return b.handle_incoming(request)
Ejemplo n.º 2
0
def backend_handle_incoming(request, backend_name):
    """
    Call the backend's handle_incoming method.
    """
    if backend_name == 'debug':
        return backend_debug(request)
    b = get_backend(backend_name)
    if b is None:
        raise Http404
    return b.handle_incoming(request)
Ejemplo n.º 3
0
def send(to, msg, signature, using=None, reliable=False):
    """
    Send an SMS message immediately.

    *   'to' is a semicolon separated list of phone numbers with an international
        prefix (+32... etc).
    *   'msg' is the message itself as a unicode object (max 160 characters).
    *   'signature' is where the message comes from. Depends on the backend in use.
    *   'using' is an optional parameter where you can specify a specific account
        to send messages from.
    """
    from smsgateway.backends import get_backend
    from smsgateway.sms import SMSRequest
    account_dict = get_account(using)
    backend = get_backend(account_dict['backend'])
    sms_request = SMSRequest(to, msg, signature, reliable=reliable)
    return backend.send(sms_request, account_dict)
Ejemplo n.º 4
0
def send(to, msg, signature, using=None, reliable=False):
    """
    Send an SMS message immediately.

    *   'to' is a semicolon separated list of phone numbers with an international
        prefix (+32... etc).
    *   'msg' is the message itself as a unicode object (max 160 characters).
    *   'signature' is where the message comes from. Depends on the backend in use.
    *   'using' is an optional parameter where you can specify a specific account
        to send messages from.
    """
    # Don't send empty smses
    if not msg:
        return

    from smsgateway.backends import get_backend
    from smsgateway.sms import SMSRequest
    account_dict = get_account(using)
    backend = get_backend(account_dict['backend'])
    sms_request = SMSRequest(to, msg, signature, reliable=reliable)
    return backend.send(sms_request, account_dict)