def remote_connection()

in gremlin/neptune-streams/lambda/neptune-streams-demo/neptune_python_utils/gremlin_utils.py [0:0]


    def remote_connection(self, show_endpoint=True):
        neptune_gremlin_endpoint = self.endpoints.gremlin_endpoint()
        if show_endpoint:
            print('gremlin: {}'.format(neptune_gremlin_endpoint))
        retry_count = 0
        while True:
            try:
                return DriverRemoteConnection(neptune_gremlin_endpoint, 'g')
            except HTTPError as e:
                exc_info = sys.exc_info()
                if retry_count < 3:
                    retry_count+=1
                    print('Connection timeout. Retrying...')
                else:
                    raise exc_info[0].with_traceback(exc_info[1], exc_info[2])