Make a GET request, and return the response as parsed JSON.
351192
def get_json(url, auth=None, data=None):
    """"""
    headers = {
        'Accept': 'application/vnd.travis-ci.2+json',
        'User-Agent': 'Travis/Tox-Travis-1.0a',
        # User-Agent must start with "Travis/" in order to work
    }
    if auth:
        headers['Authorization'] = 'token {auth}'.format(auth=auth)

    params = {}
    if data:
        headers['Content-Type'] = 'application/json'
        params['data'] = json.dumps(data).encode('utf-8')

    request = urllib2.Request(url, headers=headers, **params)
    response = urllib2.urlopen(request).read()
    return json.loads(response.decode('utf-8'))
1010857
def get(url):
    """"""
    response = urllib.request.urlopen(url)
    data = response.read()
    data = data.decode("utf-8")
    data = json.loads(data)
    return data
391222
def render_GET(self, request):
    """"""
    fullPath = request.path.split('/')
    if not fullPath[-1]:
      fullPath = fullPath[:-1]
    parts = fullPath[2:]
    statDict = util.lookup(scales.getStats(), parts)

    if statDict is None:
      request.setResponseCode(404)
      return "Path not found."

    if 'query' in request.args:
      query = request.args['query'][0]
    else:
      query = None

    if 'format' in request.args and request.args['format'][0] == 'json':
      request.headers['content-type'] = 'text/javascript; charset=UTF-8'
      formats.jsonFormat(request, statDict, query)
    elif 'format' in request.args and request.args['format'][0] == 'prettyjson':
      request.headers['content-type'] = 'text/javascript; charset=UTF-8'
      formats.jsonFormat(request, statDict, query, pretty=True)
    else:
      formats.htmlHeader(request, '/' + '/'.join(parts), self.serverName, query)
      formats.htmlFormat(request, tuple(parts), statDict, query)

    return ''
1250095
def get(self, resource, params=None, **kwargs):
        """"""
        return self.request('GET', resource, params=params, **kwargs)
811648
def _get_json_response(self, resp):
        '''  '''
        if resp is not None and resp.text is not None:
            try:
                text = resp.text.strip('\n')
                if len(text) > 0:
                    return json.loads(text)
            except ValueError as e:
                if self.debug:
                    print("Could not decode JSON response: \"%s\"" % resp.text)
                raise e
1300718
def json(self, **kwargs):
        """"""
        encoding = detect_encoding(self.content[:4])
        value = self.content.decode(encoding)

        return simplejson.loads(value, **kwargs)
1176090
def response(self, url):
        """"""
        
        resp = requests.get(url).content
        return self.parseresponse(resp)
1177877
def get(self, param=None, must=[APIKEY]):
        '''
        '''
        param = {} if param is None else param
        r = self.verify_param(param, must)
        if not r.is_succ():
            return r
        handle = CommonResultHandler(lambda rsp: {VERSION_V1:rsp.get(USER), VERSION_V2:rsp}[self.version()])
        return self.path('get.json').post(param, handle, r)
290823
def json_request(endpoint, verb='GET', session_options=None, **options):
    
    req = functools.partial(_request, endpoint, verb, session_options,
                            json=True, **options)
    return _run_in_fresh_loop(req)
490914
def get(self, endpoint):
        ''''''
        json_body = urlopen(self.url(endpoint)).read().decode('utf-8')
        return json.loads(json_body)
1175926
def _get(url:str, headers:dict) -> dict:
    
    response = requests.get(url, headers=headers)

    data = response.json()
    if response.status_code != 200:
        raise GoogleApiError({"status_code": response.status_code,
                                  "error": data.get("error", "")})
    return data
810552
def http(self, *args, **kwargs):
        """"""
        kwargs['api'] = self.api
        return http(*args, **kwargs)
84233
def _get_json_obj(self, endpoint, query, is_post=False):
        
        response = self._get_response(endpoint, query, is_post=is_post)
        content = response.text
        try:
            return loads(content)
        except ValueError:
            raise Exception('Could not decode content to JSON:\n%s'
                            % self.__class__.__name__, content)
69011
def get(self, uri, disable_proxy=False, stream=False):
        """"""
        response = requests.get(
            uri,
            headers=self.headers,
            allow_redirects=True,
            cookies={},
            stream=stream,
            proxies=self.proxy if not disable_proxy else False
        )

        if response.status_code in _PERMITTED_STATUS_CODES:
            self.response_headers = response.headers
            return response.content if not stream else response.iter_content()
        else:
            raise requests.exceptions.HTTPError(
                "HTTP response did not have a permitted status code."
            )
894955
def get(self, path, data=None):
        """"""
        data = data or {}
        response = requests.get(self.url(path), params=data, headers=self.request_header())
        return self.parse_response(response)
1164585
async def request(self, method, path, json=None, auth=True):
        """"""
        url = 'http://{}/api/'.format(self.host)
        if auth:
            url += '{}/'.format(self.username)
        url += path

        try:
            async with self.websession.request(method, url, json=json) as res:
                if res.content_type != 'application/json':
                    raise ResponseError(
                        'Invalid content type: {}'.format(res.content_type))
                data = await res.json()
                _raise_on_error(data)
                return data
        except client_exceptions.ClientError as err:
            raise RequestError(
                'Error requesting data from {}: {}'.format(self.host, err)
            ) from None
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