使用 ``request.get`` 从指定 url 获取数据

    :param params: ``输入参数, 可为空``
    :type params: dict
    :param url: ``接口地址``
    :type url:
    :param to: ``响应超时返回时间``
    :type to:
    :return: ``接口返回的数据``
    :rtype: dict
423393
def do_get(url, params, to=3):
    
    try:
        rs = requests.get(url, params=params, timeout=to)
        if rs.status_code == 200:
            try:
                return rs.json()
            except Exception as __e:
                # log.error(__e)
                return rs.text
    except Exception as er:
        log.error('get {} ({}) with err: {}'.format(url, params, er))
        time.sleep(0.5)
    return {}
951460
def _get(self, q, params=''):
        ''''''
        if (q[-1] == '/'): q = q[:-1]
        headers = {'Content-Type': 'application/json'}
        r = requests.get('{url}{q}?api_key={key}{params}'.format(url=self.url, q=q, key=self.api_key, params=params),
                        headers=headers)
        ret = DotDict(r.json())
        if (not r.ok or ('error' in ret and ret.error == True)):
            raise Exception(r.url, r.reason, r.status_code, r.json())
        return DotDict(r.json())
932821
def _get(url):
    
    if PYTHON_3:
        req = request.Request(url, headers=HEADER)
        response = request.urlopen(req)
        return response.read().decode('utf-8')
    else:
        req = urllib2.Request(url, headers=HEADER)
        response = urllib2.urlopen(req)
        return response.read()
340715
def get(self, url):
        
        r = requests.get(self._format_url(url), headers=self.headers, timeout=TIMEOUT)
        self._check_response(r, 200)

        return r.json()
1235018
def http_get(url, params={})
      uri = URI(url)
      uri.query = URI.encode_www_form(params)
      Okcoin::logger.debug( 'GET: ' + (uri.query.blank? ? url : "#{url}?#{uri.query}") )

      response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
        request = Net::HTTP::Get.new uri
        http.request request
      end

      if response.is_a?(Net::HTTPOK)
        JSON.parse(response.body)
      else
        Okcoin::logger.error('response code is not 200!')
        nil # todo: 报个异常
      end
    end
971790
def request(self, url, parameters):
        

        try:
            request = Request(url + '?' + urlencode(parameters), None, {
                'X-Authentication-Token': self.api_key,
                'User-Agent': self.user_agent
                },
                None,
                False,
                "GET"
            )

            response = urlopen(request)
        except HTTPError as e:
            self.logger.error('Code: ' + str(e.code))
            self.logger.error('Response: ' + str(e.reason))

            if e.code == 400:
                raise UnknownOutputFormatException()

            if e.code == 401:
                raise AuthorizationRequiredException()

            if e.code == 402:
                raise NotEnoughCreditsException()

            if e.code == 403:
                raise AccessDeniedException()

            if e.code == 422:
                raise InvalidMacOrOuiException()

            if e.code >= 500:
                raise ServerErrorException("Response code: {}".format(e.code))

            raise ServerErrorException(e.reason)

        if response.code >= 300 or response.code < 200:
            raise ServerErrorException("Response code: {}".format(response.code))

        headers = dict(response.getheaders())
        if "Warning" in headers.keys():
            self.logger.warning(headers["Warning"])

        self.logger.debug(response.info())

        return response.read()
267508
def get_url(url):
    

    r = requests.get(url)
    charset = r.apparent_encoding
    r.encoding = charset
    html_code = r.text.lower()

    log('debg', '获取【{}】成功，网页编码格式为：【{}】'.format(url, charset))
    return html_code, charset
28584
def get_url(self, url, fields=None, **urlopen_kw):
        
        return self.request_encode_url('GET', url, fields=fields,
                                       **urlopen_kw)
825195
def _get(self, url, params=None):
        
        self._call(self.GET, url, params, None)
889525
public static String get(String url,
                             Map<String, String> headers,
                             String params) throws IOException {

        // 参数
        if (StringUtil.isNotEmpty(params)) {
            url += "?" + params;
        }

        HttpURLConnection httpUrlConn = httpUrlConn(url);
        httpUrlConn.setDoInput(true);
        httpUrlConn.setRequestMethod(Constant.RequestMethodGet);

        // header
        if (headers != null) {
            header(headers, httpUrlConn);
        }

        httpUrlConn.connect();

        return readIO(httpUrlConn);
    }
281165
def make_request(self, url, params, auth=None):
        
        req = urllib2.Request(url + urllib.urlencode(params))

        if auth:
            req.add_header('AUTHORIZATION', 'Basic ' + auth)

        return urllib2.urlopen(req)
605133
def get(self, url, params=None, callback=None, retry=0, **kwargs):
        """"""
        kwargs.setdefault("allow_redirects", True)
        return self.request(
            "get", url=url, params=params, callback=callback, retry=retry, **kwargs
        )
436414
def key_for_request(self, method, url, **kwargs):
        
        if method != 'get':
            return None

        return requests.Request(url=url, params=kwargs.get('params', {})).prepare().url
976092
def get(request_uri, params={})
      sp = signed_params("GET", request_uri, params)
      http_client.get(request_uri, sp)
    end
1036775
def _request_get_helper(self, url, params=None):
        ''''''
        if not isinstance(params, dict):
            params = dict()

        if self.api_key:
            params['api_key'] = self.api_key
        return requests.get(url, params=params, timeout=60)
141698
def _get(self, url, params={}):
        """"""
        r = requests.get(self._api_prefix + url,
            params=params,
            headers=self.headers,
            auth=self.auth,
        )
        return self._action(r)
1282278
def _get(self, *args, **kwargs):
        
        return self._request(requests.get, *args, **kwargs)