def open(cls, profile, user_agent=None, on_bind=None, on_unbind=None, on_release=None, on_broken=None): """ Open a connection to a server. :param profile: :class:`.ConnectionProfile` detailing how and where to connect :param user_agent: :param on_bind: :param on_unbind: :param on_release: :param on_broken: :returns: :class:`.Bolt` connection object :raises: :class:`.ConnectionUnavailable` if a connection cannot be opened :raises: ValueError if the profile references an unsupported scheme """ if profile.protocol == "bolt": from py2neo.client.bolt import Bolt return Bolt.open(profile, user_agent=user_agent, on_bind=on_bind, on_unbind=on_unbind, on_release=on_release, on_broken=on_broken) elif profile.protocol == "http": from py2neo.client.http import HTTP return HTTP.open(profile, user_agent=user_agent, on_bind=on_bind, on_unbind=on_unbind, on_release=on_release, on_broken=on_broken) else: raise ValueError("Unknown scheme %r" % profile.scheme)
def default_hydrant(cls, profile, graph): if profile.protocol == "bolt": from py2neo.client.bolt import Bolt return Bolt.default_hydrant(profile, graph) elif profile.protocol == "http": from py2neo.client.http import HTTP return HTTP.default_hydrant(profile, graph) else: raise ValueError("Unknown scheme %r" % profile.scheme)
def open(cls, profile, user_agent=None, on_bind=None, on_unbind=None, on_release=None): if profile.protocol == "bolt": from py2neo.client.bolt import Bolt return Bolt.open(profile, user_agent=user_agent, on_bind=on_bind, on_unbind=on_unbind, on_release=on_release) elif profile.protocol == "http": from py2neo.client.http import HTTP return HTTP.open(profile, user_agent=user_agent, on_bind=on_bind, on_unbind=on_unbind, on_release=on_release) else: raise ValueError("Unknown scheme %r" % profile.scheme)