<commit_before>#!/usr/bin/env python
# coding=utf-8
#
from suds.client import Client as Suds

from .lib.core import Core
from .lib.translator import Translator
from .lib.helpers import Helpers

import types


class PureResponseClient(object):
    version = '1.2.7'

    api_client = None
    api_account_level = None

    api_core = None
    api_translator = None

    encoding_exceptions = [Core.Entity.ID,
                           Core.Message.ID,
                           Core.List.ID,
                           Core.Api.USERNAME,
                           Core.Api.PASSWORD]

    class AccountLevel:
        LITE = 10
        PRO = 20
        EXPERT = 40

    def __init__(self, api_version=Core.Api.RPC_LITERAL_UNBRANDED):
        self.api_client = Suds(api_version)
        self.api_translator = Translator(self)
        self.api_core = Core(self)

        self.register_helpers()


    def authenticate(self, api_username=None, api_password=None, api_account_level=AccountLevel.LITE):
        """
        Authenticates a username and password against the PureResponse API,
        must be done before making all other API calls.
        ------------------------------------------------
        @param api_username              - username of account from which to make api calls
        @param api_password              - password of that same account
        @param [api_account_level]       - your api account level indicates how many custom
                                           fields you are allowed to use in contact lists

                                           if you indicate a level higher than that of your
                                           account a pyresponse.Core.StoreErrors will be raised<commit_msg>pass timeout option to suds client<commit_after>#!/usr/bin/env python
# coding=utf-8
#
from suds.client import Client as Suds

from .lib.core import Core
from .lib.translator import Translator
from .lib.helpers import Helpers

import types


class PureResponseClient(object):
    version = '1.2.7'

    api_client = None
    api_account_level = None

    api_core = None
    api_translator = None

    default_timeout = 300

    encoding_exceptions = [Core.Entity.ID,
                           Core.Message.ID,
                           Core.List.ID,
                           Core.Api.USERNAME,
                           Core.Api.PASSWORD]

    class AccountLevel:
        LITE = 10
        PRO = 20
        EXPERT = 40

    def __init__(self, api_version=Core.Api.RPC_LITERAL_UNBRANDED, timeout=default_timeout):
        self.api_client = Suds(api_version, timeout=timeout)
        self.api_translator = Translator(self)
        self.api_core = Core(self)

        self.register_helpers()


    def authenticate(self, api_username=None, api_password=<PASSWORD>, api_account_level=AccountLevel.LITE):
        """
        Authenticates a username and password against the PureResponse API,
        must be done before making all other API calls.
        ------------------------------------------------
        @param api_username              - username of account from which to make api calls
        @param api_password              - <PASSWORD>
        @param [api_account_level]       - your api account level indicates how many custom
                                           fields you are allowed to use in contact lists

                                           if you indicate a level higher than that of your
                                           account a pyresponse.Core.StoreErrors will be raised
{'fraction_non_alphanumeric': 0.08489773045671056, 'fraction_numerical': 0.00644438217988232, 'mean_word_length': 1.652303120356612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '200149', 'n_tokens_mistral': 919, 'n_tokens_neox': 872, 'n_words': 274}