import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    templates = client.get_templates()
    for template in templates:
        print(vars(template))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    id = client.add_to_stop_list('70000000000')
    print(id)
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    hrl_statistics = client.get_hlr_statistic('2013-12-01', '2014-12-22')
    for hrl_statistic in hrl_statistics:
        print((vars(hrl_statistic)))
except IntisError as e:
    print(e)
示例#4
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    network = client.get_network_by_phone('79090099090')
    print(network)
except IntisError as e:
    print(e)
示例#5
0
class IntisTest(unittest.TestCase):

    def setUp(self):
        self.client = IntisClient(settings.login, settings.api_key, debug=settings.debug)

    def test_timestamp(self):
        self.assertRegex(self.client.timestamp, '^\d{10}$')

    def test_balance(self):
        balance = self.client.get_balance()
        self.assertIsInstance(balance, models.Balance)
        self.assertIsInstance(balance.money, float)
        self.assertIsInstance(balance.currency, str)

    def test_bases(self):
        for base in self.client.get_phone_bases():
            self.assertIsInstance(base, models.PhoneBase)
            self.assertIsInstance(base.id, int)

    def test_senders(self):
        for sender in self.client.get_senders():
            self.assertIsInstance(sender, models.Sender)

    def test_phones(self):
        bases = self.client.get_phone_bases()
        for base in bases:
            self.assertIsInstance(base, models.PhoneBase)
            phone_numbers = self.client.get_phone_base_numbers(base.id)
            for phone_number in phone_numbers:
                self.assertIsInstance(phone_number, models.PhoneBaseNumber)

    def test_message_send(self):
        sender = self.client.get_senders()[0]
        messages = self.client.message_send(settings.phone, sender.sender, 'Test message')
        for message in messages:
            self.assertIsInstance(message, models.Message)
            statuses = self.client.get_message_status(message.id_sms)
            for status in statuses:
                self.assertIsInstance(status, models.MessageStatus)

    def test_stop_list(self):
        phone = settings.phone
        try:
            id = self.client.add_to_stop_list(phone)
            self.assertIsNotNone(id)
        except IntisApiError:
            pass

        find_stop_list = self.client.find_in_stop_list(phone)
        self.assertIsNotNone(find_stop_list.time_in)

    def test_template(self):
        name = 'TemplateTest'

        template_id = self.client.add_template(name, 'Hello')
        self.assertIsNotNone(template_id)

        template_list = self.client.get_templates()
        exists = False
        for template in template_list:
            if template.name == name:
                exists = True
                break

        if not exists:
            raise Exception

        result = self.client.delete_template(name)
        self.assertEqual(result, 'deleted')

        template_list = self.client.get_templates()
        exists = False
        for template in template_list:
            if template.name == name:
                exists = True
                break

        if exists:
            raise Exception

    def test_statistic(self):
        for stat in self.client.get_statistic_on_month(2016, 7):
            self.assertIsInstance(stat, models.Statistic)

    def test_hlr_request(self):
        for hlr in self.client.make_hlr_request(settings.phone):
            self.assertIsInstance(hlr, models.HLRResponse)

    def test_hlr_statistic(self):
        from_date, to_date = '2016-01-01', '2016-09-01'
        for statistic in self.client.get_hlr_statistic(from_date, to_date):
            self.assertIsInstance(statistic, models.HLRStatistic)

    def test_network_by_phone(self):
        result = self.client.get_network_by_phone(settings.phone)
        self.assertIsInstance(result, models.Operator)

    def test_inbox_messages(self):
        date_from = '2016-01-01'
        try:
            self.client.get_inbox_messages(date_from)
        except IntisApiError:
            pass

    def test_price(self):
        for price in self.client.get_prices():
            self.assertIsInstance(price, models.Price)
示例#6
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    balance = client.get_balance()
    print(vars(balance))
except IntisError as e:
    print(e)
示例#7
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    prices = client.get_prices()
    for price in prices:
        print(vars(price))
except IntisClient.Error as e:
    print(e)
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    stop_list = client.find_in_stop_list('79141231212')
    print(vars(stop_list))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST
client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    phone_bases = client.get_phone_bases()
    for phone_base in phone_bases:
        phone_base_numbers = client.get_phone_base_numbers(phone_base.id)
        for phone_base_number in phone_base_numbers:
            pprint(vars(phone_base_number))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    stop_list = client.find_in_stop_list('79141231212')
    print(vars(stop_list))
except IntisError as e:
    print(e)
示例#11
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    statistic_list = client.get_statistic_on_month(2014, 12)
    for statistic in statistic_list:
        print((vars(statistic)))
except IntisError as e:
    print(e)
 def setUp(self):
     self.client = IntisClient(settings.login,
                               settings.api_key,
                               debug=settings.debug)
class IntisTest(unittest.TestCase):
    def setUp(self):
        self.client = IntisClient(settings.login,
                                  settings.api_key,
                                  debug=settings.debug)

    def test_timestamp(self):
        self.assertRegex(self.client.timestamp, '^\d{10}$')

    def test_balance(self):
        balance = self.client.get_balance()
        self.assertIsInstance(balance, models.Balance)
        self.assertIsInstance(balance.money, float)
        self.assertIsInstance(balance.currency, str)

    def test_bases(self):
        for base in self.client.get_phone_bases():
            self.assertIsInstance(base, models.PhoneBase)
            self.assertIsInstance(base.id, int)

    def test_senders(self):
        for sender in self.client.get_senders():
            self.assertIsInstance(sender, models.Sender)

    def test_phones(self):
        bases = self.client.get_phone_bases()
        for base in bases:
            self.assertIsInstance(base, models.PhoneBase)
            phone_numbers = self.client.get_phone_base_numbers(base.id)
            for phone_number in phone_numbers:
                self.assertIsInstance(phone_number, models.PhoneBaseNumber)

    def test_message_send(self):
        sender = self.client.get_senders()[0]
        messages = self.client.message_send(settings.phone, sender.sender,
                                            'Test message')
        for message in messages:
            self.assertIsInstance(message, models.Message)
            statuses = self.client.get_message_status(message.id_sms)
            for status in statuses:
                self.assertIsInstance(status, models.MessageStatus)

    def test_stop_list(self):
        phone = settings.phone
        try:
            id = self.client.add_to_stop_list(phone)
            self.assertIsNotNone(id)
        except IntisApiError:
            pass

        find_stop_list = self.client.find_in_stop_list(phone)
        self.assertIsNotNone(find_stop_list.time_in)

    def test_template(self):
        name = 'TemplateTest'

        template_id = self.client.add_template(name, 'Hello')
        self.assertIsNotNone(template_id)

        template_list = self.client.get_templates()
        exists = False
        for template in template_list:
            if template.name == name:
                exists = True
                break

        if not exists:
            raise Exception

        result = self.client.delete_template(name)
        self.assertEqual(result, 'deleted')

        template_list = self.client.get_templates()
        exists = False
        for template in template_list:
            if template.name == name:
                exists = True
                break

        if exists:
            raise Exception

    def test_statistic(self):
        for stat in self.client.get_statistic_on_month(2016, 7):
            self.assertIsInstance(stat, models.Statistic)

    def test_hlr_request(self):
        for hlr in self.client.make_hlr_request(settings.phone):
            self.assertIsInstance(hlr, models.HLRResponse)

    def test_hlr_statistic(self):
        from_date, to_date = '2016-01-01', '2016-09-01'
        for statistic in self.client.get_hlr_statistic(from_date, to_date):
            self.assertIsInstance(statistic, models.HLRStatistic)

    def test_network_by_phone(self):
        result = self.client.get_network_by_phone(settings.phone)
        self.assertIsInstance(result, models.Operator)

    def test_inbox_messages(self):
        date_from = '2016-01-01'
        try:
            self.client.get_inbox_messages(date_from)
        except IntisApiError:
            pass

    def test_price(self):
        for price in self.client.get_prices():
            self.assertIsInstance(price, models.Price)
示例#14
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    balance = client.get_balance()
    print(vars(balance))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    template_id = client.add_template('TEMPLATE_NAME', 'Some template text')
    print(template_id)
except IntisError as e:
    print(e)
示例#16
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    hrl_statistics = client.get_hlr_statistic('2013-12-01', '2014-12-22')
    for hrl_statistic in hrl_statistics:
        print(vars(hrl_statistic))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    statistic_list = client.get_statistic_on_month(2014, 12)
    for statistic in statistic_list:
        print(vars(statistic))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    message_status_list = client.get_message_status('4192072123106546180001')
    for message_status in message_status_list:
        print((vars(message_status)))
except IntisError as e:
    print(e)
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    network = client.get_network_by_phone('79090099090')
    print(network)
except IntisError as e:
    print(e)
示例#20
0
import os, sys

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    hrl_response_list = client.make_hrl_request('79143453229')
    for hrl_response in hrl_response_list:
        print((vars(hrl_response)))
except IntisError as e:
    print(e)
示例#21
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    senders = client.get_senders()
    for sender in senders:
        print(vars(sender))
except IntisError as e:
    print(e)
示例#22
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    templates = client.get_templates()
    for template in templates:
        print(vars(template))
except IntisError as e:
    print(e)
示例#23
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    senders = client.get_senders()
    for sender in senders:
        print(vars(sender))
except IntisError as e:
    print(e)
示例#24
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    hrl_response_list = client.make_hrl_request('79143453229')
    for hrl_response in hrl_response_list:
        print(vars(hrl_response))
except IntisError as e:
    print(e)
示例#25
0
 def setUp(self):
     self.client = IntisClient(settings.login, settings.api_key, debug=settings.debug)
示例#26
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    inbox_messages = client.get_inbox_messages('2014-11-25')
    for inbox_message in inbox_messages:
        print(vars(inbox_message))
except IntisError as e:
    print(e)
示例#27
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    phone_bases = client.get_phone_bases()
    for phone_base in phone_bases:
        print(vars(phone_base))
except IntisError as e:
    print(e)
示例#28
0
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST


client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    template_id = client.add_template('TEMPLATE_NAME', 'Some template text')
    print(template_id)
except IntisError as e:
    print(e)
示例#29
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    phone_bases = client.get_phone_bases()
    for phone_base in phone_bases:
        print((vars(phone_base)))
except IntisError as e:
    print(e)
示例#30
0
import os, sys

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    prices = client.get_prices()
    for price in prices:
        print((vars(price)))
except IntisClient.Error as e:
    print(e)
示例#31
0
import os, sys

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
messages = client.message_send('79140000000', 'SMS4TEST', 'hello')
for message in messages:
    print(vars(message))
示例#32
0
import os, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))

from intis import IntisClient, IntisError
from examples.conf import API_LOGIN, API_KEY, API_HOST

client = IntisClient(API_LOGIN, API_KEY, host=API_HOST)
try:
    id = client.add_to_stop_list('70000000000')
    print(id)
except IntisError as e:
    print(e)