Returns the response for the given url. The optional data argument is
    passed directly to urlopen.
499435
def download_page(url, data=None):
    ''''''
    conn = urllib2.urlopen(url, data)
    resp = conn.read()
    conn.close()
    return resp
723243
function _request(url, opt) {
      opt = opt || {};
      opt.method = (opt.method || 'GET').toUpperCase();
      opt.headers = opt.headers || {};
      if (matchUrl(url) && matchMethod(opt.method)) {
        const result = extend(true, {}, mockResult);
        const response = {
          status: result.status,
          statusCode: result.status,
          headers: result.headers,
          size: result.responseSize,
          aborted: false,
          rt: 1,
          keepAliveSocket: result.keepAliveSocket || false,
        };

        httpclient.emit('response', {
          error: null,
          ctx: opt.ctx,
          req: {
            url,
            options: opt,
            size: result.requestSize,
          },
          res: response,
        });
        if (opt.dataType === 'json') {
          try {
            result.data = JSON.parse(result.data);
          } catch (err) {
            err.name = 'JSONResponseFormatError';
            throw err;
          }
        } else if (opt.dataType === 'text') {
          result.data = result.data.toString();
        }
        return Promise.resolve(result);
      }
      return rawRequest.call(httpclient, url, opt);
    }
250930
def _grabContentFromUrl(self, url):
        
        # Defining an empty object for the response
        response = {}

        # This part has to be modified...        
        try:
            import urllib2

            # Grabbing the data      
            data = urllib2.urlopen(url).read()

            # Processing the data as expectesd
            response = self._createDataStructure(data)        
            
        # Try to make the errors clear for other users
        except Exception, e:
            errMsg = "ERROR. Something happened."   
            raise Exception( errMsg + " " + str(e))
            
        return response
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()
300232
def post(self, url):
        
        return requests.post(url, data=self.data, headers=self.config.HEADERS)
28584
def get_url(self, url, fields=None, **urlopen_kw):
        
        return self.request_encode_url('GET', url, fields=fields,
                                       **urlopen_kw)
825433
def _http_call(self, url, method, data=None, **kwargs):
        
        response = self._http_response(url, method, data=data, **kwargs)
        if not response.content:
            return {}

        return response.json()
653095
def request(self, url, method = u"get", data = None, headers = None, **kwargs):
        

        url, method, data, headers, kwargs = self._pre_request(url, 
                                                                 method=method,
                                                                 data=data,
                                                                 headers=headers,
                                                                 **kwargs)
        response = self._request(url, method=method, data=data, headers=headers, **kwargs)
        response = self._post_request(response)
        
        # raises the appropriate exceptions
        response = self._handle_response(response)
        
        return response
593989
def post(self, url, data=None, params=None):
        
        return self.request("post", url, data, params)
787720
def fget(url, **options)
      uri = _assert_uri(url)
      Responses::ResponsePromise.new { get(uri, options) }
    end
362221
def get_response(self, path, **params):
        
        url = "%s%s" % (self.base_url, path)
        return self._get_response(url, **params)
101760
def get_response(self, url, timeout=None):
        
        if not timeout:
            timeout = self.default_timeout

        if self.default_sleeptime:
            time.sleep(self.default_sleeptime)

        try:
            return self.auth.get(url, headers=self.default_header, timeout=self.default_timeout)
        except:
            return None
659125
def get_req(url):
    """"""
    request = urllib.request.Request(url)
    request.add_header('Authorization', 'token %s' % API_TOKEN)
    try:
        response = urllib.request.urlopen(request).read().decode('utf-8')
        return response
    except urllib.error.HTTPError:
        exception()
        sys.exit(0)
222329
def get_response(self, request):
        ''''''
        # the redirect key is already placed in the response by HttpResponseJavascriptRedirect
        return HttpResponseJavascriptRedirect(self.redirect_to, *self.args, **self.kwargs)
402483
public static Response getRedirectResponse(final String url, final Map<String, String> parameters) {
        val builder = new StringBuilder(parameters.size() * RESPONSE_INITIAL_CAPACITY);
        val sanitizedUrl = sanitizeUrl(url);
        LOGGER.debug("Sanitized URL for redirect response is [{}]", sanitizedUrl);
        val fragmentSplit = Splitter.on("#").splitToList(sanitizedUrl);
        builder.append(fragmentSplit.get(0));
        val params = parameters.entrySet()
            .stream()
            .filter(entry -> entry.getValue() != null)
            .map(entry -> {
                try {
                    return String.join("=", entry.getKey(), EncodingUtils.urlEncode(entry.getValue()));
                } catch (final Exception e) {
                    return String.join("=", entry.getKey(), entry.getValue());
                }
            })
            .collect(Collectors.joining("&"));
        if (!(params == null || params.isEmpty())) {
            builder.append(url.contains("?") ? "&" : "?");
            builder.append(params);
        }
        if (fragmentSplit.size() > 1) {
            builder.append('#');
            builder.append(fragmentSplit.get(1));
        }
        val urlRedirect = builder.toString();
        LOGGER.debug("Final redirect response is [{}]", urlRedirect);
        return new DefaultResponse(ResponseType.REDIRECT, urlRedirect, parameters);
    }
225443
def jsonp_response(data, callback="f", status=200, serializer=None):
    
    val = json.dumps(data, default=serializer)
    ret = "{callback}('{val}');".format(callback=callback, val=val)

    return HttpResponse(ret,
                        status=status,
                        content_type='application/x-javascript; charset=UTF-8')
1062539
def _GetURLContent(url):
    """"""
    response = urllib_request.urlopen(url)
    encoding = response.info().get('Content-Encoding')
    if encoding == 'gzip':
        content = _Gunzip(response.read())
    else:
        content = response.read()
    return content