http endpoint decorator
169887
def profile(*args, **kwargs):
    
    if _is_initialized():
        def wrapper(f):
            return wrapHttpEndpoint(f)

        return wrapper
    raise Exception(
        "before measuring anything, you need to call init_app()")
1123613
def endpoint_search(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.search_endpoints(**kwargs)
691156
def _build_url(self, endpoint):
        
        try:
            path = self.endpoints[endpoint]
        except KeyError:
            msg = 'Unknown endpoint `{0}`'
            raise ValueError(msg.format(endpoint))
        absolute_url = urljoin(self.target, path)
        return absolute_url
1108922
function registerEndpoint(url, handler) {
        tchannel.register(url, function (req, res, arg2, arg3) {

            self.middlewareStack.run(req, arg2, arg3,
                function(req, arg2, arg3, callback) {
                    handler(arg2, arg3, req.remoteAddr, callback);
                },
                function(req, err, res1, res2) {
                    res.headers.as = 'raw';
                    if (err) {
                        res.sendNotOk(null, JSON.stringify(err));
                    } else {
                        if (res2 && !Buffer.isBuffer(res2)) {
                            res2 = new Buffer(res2);
                        }

                        res.sendOk(res1, res2);
                    }
                });

        });
    }
161078
function Endpoint(spec, resourcePath, method) {
  this.method = method;
  this.resourcePath = resourcePath || '/';
  this.spec = spec;
}
1309526
def getEndpoint(self):
        
        port = ''
        endpoint = ''
        keyConfig = self.getKeyConfig()
        if 'port' in keyConfig:
            port = ':' + keyConfig['port']
        elif self._data['port'] != self.PORT:
            port = ':' + self._data['port']
        if 'endpoint' in keyConfig:
            endpoint = keyConfig['endpoint']
        else:
            endpoint = self._data['endpoint']
        return 'https://%s%s/%s/' % (endpoint,
                                     port,
                                     self._data['api_version'])
239451
function ConnectionServer(endpoint, options, connectionListener) {
  events.EventEmitter.call(this);

  if (!(endpoint instanceof Endpoint)) {
    endpoint = new Endpoint(endpoint);
  }
  if (typeof options === 'function') {
    connectionListener = options;
    options = undefined;
  }

  this.endpoint = endpoint;
  this.options = options || {};
  if (typeof connectionListener === 'function') {
    this.on('connection', connectionListener);
  }

  listen.call(this);
}
262507
def post(self, endpoint, return_response=False, **kwargs):
        
        args = self.translate_kwargs(**kwargs)
        response = self.session.post(self.make_url(endpoint), **args)

        decoded_response = _decode_response(response)

        if return_response:
            return decoded_response, response
        return decoded_response
610329
def endpoint_get(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.get_endpoint(**kwargs)
44657
def put(self, endpoint, **kwargs):
        
        return self._request(requests.put, endpoint, **kwargs)
247379
def document_endpoint(endpoint):
    """"""
    descr = clean_description(py_doc_trim(endpoint.__doc__))
    docs = {
        'name': endpoint._route_name,
        'http_method': endpoint._http_method,
        'uri': endpoint._uri,
        'description': descr,
        'arguments': extract_endpoint_arguments(endpoint),
        'returns': format_endpoint_returns_doc(endpoint),
    }
    if hasattr(endpoint, "_success"):
        docs["success"] = endpoint._success
    if hasattr(endpoint, "_requires_permission"):
        docs["requires_permission"] = endpoint._requires_permission
    return docs
233153
def expose(url_rule, endpoint=None, **kwargs):
    """"""

    def decorate(f):
        e = endpoint or f.__name__
        endpoints[e] = f
        url_map.add(Rule(url_rule, endpoint=e, **kwargs))
        return f

    return decorate
1156341
def endpoint(value: Any) -> Any:
    
    if issubclass(type(value), Endpoint):
        return value
    elif isinstance(value, str):
        for api, cls in MANAGED_API.items():
            if value.startswith(api + " "):
                return cls.from_inline(value)
        return UnknownEndpoint.from_inline(value)
    else:
        raise TypeError("Cannot convert {0} to endpoint".format(value))
484621
def get(self, endpoint, *args, **kwargs):
        
        endpoint = self.base_url + endpoint
        return self._make_request(endpoint, type='GET')
729740
def endpoint(url):
    """"""
    if not url:
        click.secho(dtool_config.utils.get_ecs_endpoint(CONFIG_PATH))
    else:
        click.secho(dtool_config.utils.set_ecs_endpoint(CONFIG_PATH, url))
626490
def format_endpoint(schema, addr, port, api_version):
    
    return '{}://{}:{}/{}/'.format(schema, addr, port,
                                   get_api_suffix(api_version))
1321809
def handle(self, endpoint, *args, **kwargs):
        
        method = self.request_method()

        try:
            if not method in self.http_methods.get(endpoint, {}):
                raise MethodNotImplemented(
                    "Unsupported method '{}' for {} endpoint.".format(
                        method,
                        endpoint
                    )
                )

            if not self.is_authenticated():
                raise Unauthorized()

            self.data = self.deserialize(method, endpoint, self.request_body())
            view_method = getattr(self, self.http_methods[endpoint][method])
            data = view_method(*args, **kwargs)
            if is_future(data):
                # need to check if the view_method is a generator or not
                data = yield data
            serialized = self.serialize(method, endpoint, data)
        except Exception as err:
            raise gen.Return(self.handle_error(err))

        status = self.status_map.get(self.http_methods[endpoint][method], OK)
        raise gen.Return(self.build_response(serialized, status=status))