예제 #1
0
    def __init__(self,
                 protocol='http',
                 host='localhost',
                 port=8529,
                 database='_system',
                 username='******',
                 password='',
                 http_client=None,
                 enable_logging=True,
                 logger=None):

        self._protocol = protocol.strip('/')
        self._host = host.strip('/')
        self._port = port
        self._database = database or '_system'
        self._url_prefix = '{protocol}://{host}:{port}/_db/{db}'.format(
            protocol=self._protocol,
            host=self._host,
            port=self._port,
            db=self._database
        )
        self._username = username
        self._password = password
        self._http = http_client or DefaultHTTPClient()
        self._enable_logging = enable_logging
        self._type = 'standard'
        self._logger = logger or logging.getLogger('arango')
예제 #2
0
    def __init__(self,
                 protocol='http',
                 host='127.0.0.1',
                 port=8529,
                 username='******',
                 password='',
                 verify=False,
                 http_client=None,
                 enable_logging=True):

        self._protocol = protocol
        self._host = host
        self._port = port
        self._username = username
        self._password = password
        self._http_client = http_client or DefaultHTTPClient()
        self._logging = enable_logging
        self._conn = Connection(protocol=self._protocol,
                                host=self._host,
                                port=self._port,
                                database='_system',
                                username=self._username,
                                password=self._password,
                                http_client=self._http_client,
                                enable_logging=self._logging)
        self._wal = WriteAheadLog(self._conn)

        if verify:
            self.verify()
예제 #3
0
    def __init__(self,
                 protocol='http',
                 host='127.0.0.1',
                 port=8529,
                 username='******',
                 password='',
                 verify=False,
                 http_client=None,
                 enable_logging=True,
                 check_cert=True,
                 use_session=True,
                 logger=None):

        self._protocol = protocol
        self._host = host
        self._port = port
        self._username = username
        self._password = password
        self._http_client = DefaultHTTPClient(
            use_session=use_session,
            check_cert=check_cert) if http_client is None else http_client
        self._logging_enabled = enable_logging
        self._conn = Connection(protocol=self._protocol,
                                host=self._host,
                                port=self._port,
                                database='_system',
                                username=self._username,
                                password=self._password,
                                http_client=self._http_client,
                                enable_logging=self._logging_enabled,
                                logger=logger)
        self._wal = WriteAheadLog(self._conn)

        if verify:
            self.verify()
예제 #4
0
    def __init__(self,
                 protocol='http',
                 host='127.0.0.1',
                 port=8529,
                 username='******',
                 password='',
                 verify=False,
                 http_client=None,
                 enable_logging=True,
                 check_cert=True,
                 use_session=True,
                 logger=None,
                 async_ready=False):

        if http_client is None:
            http_client = DefaultHTTPClient(use_session=use_session,
                                            check_cert=check_cert)

        conn = BaseConnection(protocol=protocol,
                              host=host,
                              port=port,
                              database='_system',
                              username=username,
                              password=password,
                              http_client=http_client,
                              enable_logging=enable_logging,
                              logger=logger,
                              async_ready=async_ready)

        super(ArangoClient, self).__init__(conn)

        if verify:
            self.verify()
예제 #5
0
    def __init__(self,
                 protocol='http',
                 host='localhost',
                 port=8529,
                 database='_system',
                 username='******',
                 password='',
                 http_client=None,
                 enable_logging=True,
                 logger=None,
                 async_ready=False):

        if http_client is None:
            http_client = DefaultHTTPClient()

        if logger is None:
            logger = logging.getLogger('arango')

        self._protocol = protocol.strip('/')
        self._host = host.strip('/')
        self._port = port
        self._database = database
        self._url_prefix = '{protocol}://{host}:{port}/_db/{db}'.format(
            protocol=self._protocol,
            host=self._host,
            port=self._port,
            db=self._database
        )
        self._username = username
        self._password = password
        self._http = http_client
        self._enable_logging = enable_logging
        self._type = 'standard'
        self._logger = logger
        self._async_ready = async_ready

        if not async_ready:
            self._default_job = SynchronousResultJob
        else:
            self._default_job = BaseJob

        self._aql = AQL(self)
        self._parent = None
예제 #6
0
from __future__ import absolute_import, unicode_literals

from datetime import datetime

import pytest
from six import string_types

from arango import ArangoClient
from arango.http_clients import DefaultHTTPClient
from arango.database import Database
from arango.exceptions import *

from .utils import generate_db_name, arango_version

http_client = DefaultHTTPClient(use_session=False)
arango_client = ArangoClient(http_client=http_client)
bad_arango_client = ArangoClient(username='******', password='******')
db_name = generate_db_name()


def teardown_module(*_):
    arango_client.delete_database(db_name, ignore_missing=True)


def test_verify():
    assert arango_client.verify() is True
    with pytest.raises(ServerConnectionError):
        ArangoClient(username='******', password='******', verify=True)


def test_properties():