def __init__(self,
                 host='localhost',
                 port=8086,
                 username='root',
                 password='root',
                 database=None,
                 ssl=False,
                 verify_ssl=False,
                 timeout=None,
                 retries=3,
                 use_udp=False,
                 udp_port=4444,
                 proxies=None,
                 pool_size=10,
                 path='',
                 ):
        """Construct a new InfluxDBClient object."""
        self.__host = host
        self.__port = int(port)
        self._username = username
        self._password = password
        self._database = database
        self._timeout = timeout
        self._retries = retries

        self._verify_ssl = verify_ssl

        self.__use_udp = use_udp
        self.__udp_port = udp_port
        self._session = requests.Session()
        adapter = requests.adapters.HTTPAdapter(
            pool_connections=int(pool_size),
            pool_maxsize=int(pool_size)
        )

        if use_udp:
            self.udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        if not path:
            self.__path = ''
        elif path[0] == '/':
            self.__path = path
        else:
            self.__path = '/' + path

        self._scheme = "http"

        if ssl is True:
            self._scheme = "https"

        self._session.mount(self._scheme + '://', adapter)

        if proxies is None:
            self._proxies = {}
        else:
            self._proxies = proxies

        self.__baseurl = "{0}://{1}:{2}{3}".format(
            self._scheme,
            self._host,
            self._port,
            self._path)

        self._headers = {
            'Content-Type': 'application/json',
            'Accept': 'text/plain'
        }
def __init__ ( self , host = 'localhost' , port = 8086 , username = 'root' , password = 'root' , database = None , ssl = False , verify_ssl = False , timeout = None , retries = 3 , use_udp = False , udp_port = 4444 , proxies = None , pool_size = 10 , path = '' , ) : self . __host = host self . __port = int ( port ) self . _username = username self . _password = password self . _database = database self . _timeout = timeout self . _retries = retries self . _verify_ssl = verify_ssl self . __use_udp = use_udp self . __udp_port = udp_port self . _session = requests . Session ( ) adapter = requests . adapters . HTTPAdapter ( pool_connections = int ( pool_size ) , pool_maxsize = int ( pool_size ) ) if use_udp : self . udp_socket = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) if not path : self . __path = '' elif path [ 0 ] == '/' : self . __path = path else : self . __path = '/' + path self . _scheme = "http" if ssl is True : self . _scheme = "https" self . _session . mount ( self . _scheme + '://' , adapter ) if proxies is None : self . _proxies = { } else : self . _proxies = proxies self . __baseurl = "{0}://{1}:{2}{3}" . format ( self . _scheme , self . _host , self . _port , self . _path ) self . _headers = { 'Content-Type' : 'application/json' , 'Accept' : 'text/plain' }
Construct a new InfluxDBClient object.