Example #1
0
def sms_in_last(domain, days=None):
    query = SMSES().domain(domain).size(0)

    if days:
        query = query.received(date.today() - relativedelta(days=30))

    return query.run().total
Example #2
0
def sms_in_last(domain, days=None):
    query = SMSES().domain(domain).size(0)

    if days:
        query = query.received(date.today() - relativedelta(days=30))

    return query.run().total
Example #3
0
def _sms_helper(domain, direction=None, days=None):
    query = SMSES().domain(domain).size(0)

    if direction:
        query = query.direction(direction)

    if days:
        query = query.received(date.today() - relativedelta(days=30))

    return query.run().total
Example #4
0
def _sms_helper(domain, direction=None, days=None):
    query = SMSES().domain(domain).size(0)

    if direction:
        query = query.direction(direction)

    if days:
        query = query.received(date.today() - relativedelta(days=30))

    return query.run().total
Example #5
0
def _sms_helper(domain, direction=None, days=None):
    assert direction in (INCOMING, OUTGOING, None), repr(direction)
    query = SMSES().domain(domain).size(0)

    if direction == INCOMING:
        query = query.incoming_messages()
    elif direction == OUTGOING:
        query = query.outgoing_messages()

    if days:
        query = query.received(date.today() - relativedelta(days=days))

    return query.run().total
Example #6
0
def get_sms_count(domain, direction=None, days=None):
    """
    :param domain: domain name
    :param direction: can specify INCOMING or OUTGOING, or None to retrieve both
    :param days: only return count of sms docs from the past N days
    :return: number of sms docs fetched based on query parameters specified
    """
    assert direction in (INCOMING, OUTGOING, None), repr(direction)
    query = SMSES().domain(domain).size(0)

    if direction == INCOMING:
        query = query.incoming_messages()
    elif direction == OUTGOING:
        query = query.outgoing_messages()

    if days:
        days = int(days) if isinstance(days, str) else days
        query = query.received(date.today() - relativedelta(days=days))

    return query.run().total