Wrapper for the HTTP GET request.
197220
def _get(self, url, query=None, **kwargs):
        

        return self._request('get', url, query, **kwargs)
1125870
def _get(self, uri, params=None, headers=None):
        
        if not headers:
            headers = self._get_headers()

        logging.debug("URI=" + str(uri))
        logging.debug("HEADERS=" + str(headers))

        response = self.session.get(uri, headers=headers, params=params)
        logging.debug("STATUS=" + str(response.status_code))
        if response.status_code == 200:
            return response.json()
        else:
            logging.error(b"ERROR=" + response.content)
            response.raise_for_status()
304891
def get(self, params=None):
        
        return self._call('get', url=self.endpoint, params=params)
702605
def request(url, *args, **kwargs):
    """"""
    method = kwargs.get('method', 'GET')
    timeout = kwargs.pop('timeout', 10)  # hass default timeout
    req = requests.request(method, url, *args, timeout=timeout, **kwargs)
    data = req.json()
    _LOGGER.debug(json.dumps(data))
    return data
70186
def _request_get(self, path, params=None, json=True, url=BASE_URL):
        """"""
        url = urljoin(url, path)
        headers = self._get_request_headers()

        response = requests.get(url, params=params, headers=headers)
        if response.status_code >= 500:

            backoff = self._initial_backoff
            for _ in range(self._max_retries):
                time.sleep(backoff)
                backoff_response = requests.get(
                    url, params=params, headers=headers,
                    timeout=DEFAULT_TIMEOUT)
                if backoff_response.status_code < 500:
                    response = backoff_response
                    break
                backoff *= 2

        response.raise_for_status()
        if json:
            return response.json()
        else:
            return response
1262717
def get_http_response(self):
        """"""
        return _get_response(
            code=self.code,
            body=str(self),
            headers={
                'Content-Type': 'text/plain'
            }
        )
921554
def _http_get(self, url, query, **kwargs):
        

        self._normalize_query(query)

        kwargs.update({'params': query})

        return self._http_request('get', url, kwargs)
548039
def _get_request(self, request_url, request_method, **params):
        
        if request_method == 'GET':
            if params:
                request_url += '&%s' % urlencode(params)
            request = Request(request_url)
        elif request_method == 'POST':
            request = Request(request_url, urlencode(params, doseq=1))
        return request
1141511
def _get_data(self, url, accept=None):
        
        if self.parsed_endpoint.scheme == 'https':
            conn = httplib.HTTPSConnection(self.parsed_endpoint.netloc)
        else:
            conn = httplib.HTTPConnection(self.parsed_endpoint.netloc)
        head = {
            "User-Agent": USER_AGENT,
            API_TOKEN_HEADER_NAME: self.api_token,
        }
        if self.api_version in ['0.1', '0.01a']:
            head[API_VERSION_HEADER_NAME] = self.api_version
        if accept:
            head['Accept'] = accept
        conn.request("GET", url, "", head)
        resp = conn.getresponse()
        self._handle_response_errors('GET', url, resp)
        content_type = resp.getheader('content-type')
        if 'application/json' in content_type:
            return json.loads(resp.read())
        return resp.read()
79050
def get(self, uri):
        
        request = None

        try:

            request = requests.get(
                self._url(uri),
                auth=self._auth_basic(),
                headers=self._header()
            )

            request.raise_for_status()

            try:
                return request.json()
            except Exception:
                return request

        except HTTPError:
            try:
                error = request.json()
                self.logger.error(error)
                err = error.get('detail', '')
            except:
                err = request
            raise NetworkAPIClientError(err)
        finally:
            self.logger.info('URI: %s', uri)
            if request:
                self.logger.info('Status Code: %s',
                                 request.status_code if request else '')
                self.logger.info('X-Request-Id: %s',
                                 request.headers.get('x-request-id'))
                self.logger.info('X-Request-Context: %s',
                                 request.headers.get('x-request-context'))
507672
def get(self, uri_relative, params, custom_headers):
        

        return self._request(
            self._METHOD_GET,
            uri_relative,
            self._BYTES_EMPTY,
            params,
            custom_headers
        )
141630
def _get(self, **kwargs):
        """"""
        path = self._construct_path_to_item()
        return self._http.get(path)
449034
def geturl_req(url):
    """"""
    request = urllib.request.Request(url)
    request.add_header('Authorization', 'token %s' % API_TOKEN)
    try:
        response_url = urllib.request.urlopen(request).geturl()
        return response_url
    except urllib.error.HTTPError:
        exception()
        sys.exit(0)
443893
def get(url, **kwargs):
    
    headers = kwargs.get('headers', {})
    headers['User-Agent'] = config.USER_AGENT # overwrite
    kwargs['headers'] = headers

    timeout = kwargs.get('timeout', config.TIMEOUT)
    kwargs['timeout'] = timeout

    kwargs['verify'] = False # no SSLError

    logger.debug("Getting: %s", url)
    return requests.get(url, **kwargs)
70264
def rest_get(url, timeout, show_error=False):
    ''''''
    try:
        response = requests.get(url, timeout=timeout)
        return response
    except Exception as exception:
        if show_error:
            print_error(exception)
        return None
963449
def http_get(blink, url, stream=False, json=True, is_retry=False):
    
    if blink.auth_header is None:
        raise BlinkException(ERROR.AUTH_TOKEN)
    _LOGGER.debug("Making GET request to %s", url)
    return http_req(blink, url=url, headers=blink.auth_header,
                    reqtype='get', stream=stream, json_resp=json,
                    is_retry=is_retry)
228330
def _http_request(url,
                  method='GET',
                  headers=None,
                  data=None):
    '''
    
    '''
    req = requests.request(method,
                           url,
                           headers=headers,
                           data=data)
    ret = _default_ret()
    ok_status = METHOD_OK_STATUS.get(method, 200)
    if req.status_code != ok_status:
        ret.update({
            'comment': req.json().get('error', '')
        })
        return ret
    ret.update({
        'result': True,
        'out': req.json() if method != 'DELETE' else None  # no body when DELETE
    })
    return ret