/*
Get content of a resource from provided url or a valid cached item

Parameters:
- url (string): url to the resource
- bubbleError (boolean): if true, throw and generated error
10781
function get(url, bubbleError) {

        /* use url as key for the cache */
        var value = cache.fetch(url)
        var defer = $.Deferred()

        if (value) {
            return defer.resolve(value) /* return a resolved promise with the cached value */
        } else {
            try {
                $.get(url)
                    .done(function(value) {
                        defer.resolve(cache.save(url, decode(value)))
                    }).fail(function(err) {
                        log(err.error)
                    })
            } catch (err) {
                if (bubbleError) {
                    throw new Error(err)
                } else {
                    log(err.error)
                }
            }
        }
        return defer
    }
1199741
def fromurl(url):
  
  ps = PatchSet( urllib_request.urlopen(url) )
  if ps.errors == 0:
    return ps
  return False
347943
def get_url(url: str) -> Union[dict, int, float, str]:
        ''''''

        request = Request(url, headers={"User-Agent": "pypeerassets"})
        response = cast(HTTPResponse, urlopen(request))
        if response.status != 200:
            raise Exception(response.reason)
        return json.loads(response.read().decode())
249674
def get(self, url, params=None, raw=False, stream=False, **request_kwargs):
        

        full_url = self.build_url(url)
        params = params or {}

        # Add token (if it's not already there)
        if self._token:
            params.setdefault('token', self._token)

        response = requests.get(full_url, params=params, stream=stream,
                                **request_kwargs)
        self.check_for_errors(response)  # Raise exception if something failed

        if stream:
            return response
        if raw or not response.content:
            return response.content
        return json.loads(response.text)
807116
def get_item(self, url):
        

        _hash = self.build_hash(url)
        query = {'_id': _hash}
        return self.dbase.cache.find_one(query)
373460
def get(self, url):
        

        response = requests.get(
            self.host + url,
            headers={
                'Authorization': 'Bearer ' + self.token,
                'x-falkonry-source':self.sourceHeader
            },
            verify=False
        )
        if response.status_code == 200:
            try:
                return json.loads(response._content.decode('utf-8'))
            except Exception as error:
                return response.content
        elif response.status_code == 401:
            raise Exception(json.dumps({'message':'Unauthorized Access'}))
        else:
            raise Exception(response.content)
1244103
def get(self, url, params=dict()):
        
        try:
            res = requests.get(url, headers=self.headers, params=params)
            return json.loads(res.text)
        except Exception as e:
            print(e)
            return "error"
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
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()
1120103
static function FileGet($url, $data = "", $verify_cert = false, $timeout = 30)
	{
		$qs = HttpRequest::ArrayToQueryString($data);
		$full_url = $url . ($qs ? "?" . $qs : "");
		return file_get_contents( $full_url );
	}
754933
def _parse_url_and_validate(cls, url):
        
        parsed_url = urlparse(url)
        if parsed_url.scheme and parsed_url.netloc:
            final_url = parsed_url.geturl()
        else:
            raise BadURLException
        return final_url
1339320
function getURLSource(url) {
      var urlRegExp = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
      var sources = Object.keys(Embedo.defaults.SOURCES) || [];

      if (!urlRegExp.test(url)) {
        return null;
      }

      var matched_source = sources
        .filter(function (source) {
          if (Embedo.defaults.SOURCES[source] && url.match(Embedo.defaults.SOURCES[source].REGEX)) {
            return source;
          }
        })
        .filter(Boolean);

      return matched_source && matched_source.length ? matched_source[0] : 'iframe';
    }
1127850
def get_resource(url, subdomain):
    
    headers = {"Accept": "application/vnd.collection+json"}
    response = IASYSTEM_DAO().getURL(url, headers, subdomain)

    logger.info("%s ==status==> %s" % (url, response.status))

    if response.status != 200:
        logger.error("%s ==data==> %s" % (url, response.data))
        raise DataFailureException(url, response.status, response.data)

    return json.loads(response.data)
323535
def get(self, url, params=None):
        ''
        url = self.escapeUrl(url)

        content = six.BytesIO(self.raw(url, params=params))
        # We need to make sure that the xml fits in available memory before we parse
        # with lxml.objectify.fromstring(), or else it will bomb out.
        # If it is too big, we need to buffer it to disk before we run it through objectify. see #87
        #
        # get length of buffer
        content.seek(0,2)
        contentlen = content.tell()
        content.seek(0)

        MAX_BUFFER_SIZE=1024*1024*200 # 200MB. TODO: find a way to compute this
        if contentlen > MAX_BUFFER_SIZE:
            # xml is too big to parse with lxml.objectify.fromstring()
            contentfile = tempfile.NamedTemporaryFile()
            contentfile.write(content.read())
            o = lxml.objectify.parse(contentfile)
        else:
            o = lxml.objectify.fromstring(content.getvalue())
        if o.tag == 'error':
            JFSError.raiseError(o, url)
        return o
813173
def _get_content(cls, url, headers=HTTP_HEADERS):
        
        session = requests.Session()
        return session.get(url, headers=headers)
716298
function get (url, callback) {
  https.get(url, function onResponse (res) {
    if (res.statusCode !== 200) {
      callback(new Error('got status code ' + res.statusCode + ' from ' + URL))
    } else {
      getBody(res, true, callback)
    }
  })
}
1279513
def _get(url, params=None):
        """"""
        try:
            response = requests.get(url, params=params)
            response.raise_for_status()
            # If JSON fails, return raw data
            # (e.g. when downloading CSV job logs).
            try:
                return response.json()
            except ValueError:
                return response.text
        except NameError:
            url = '{0}?{1}'.format(url, urllib.urlencode(params))
            return json.loads(urllib2.urlopen(url).read().decode(ENCODING))