For HypermediaResource - make an API call to a list of known URLs
501912
def _call_api_many_related_resources(self, resource, url_list,
                                         method_name, **kwargs):
        
        responses = []
        for url in url_list:
            params = {
                'headers': self.get_http_headers(
                    resource.Meta.name, method_name, **kwargs),
                'url': url
            }
            prepared_request = self.prepare_http_request(
                'GET', params, **kwargs)
            response = self.session.send(prepared_request)
            result = self._handle_response(
                response, resource.Meta.valid_status_codes, resource)
            if len(result) > 1:
                responses.append(result)
            else:
                responses.append(result[0])
        return responses
1295928
def fetchUrls(cls, url, data, urlSearch):
        """"""
        searchUrls = []
        if cls.css:
            searchFun = data.cssselect
        else:
            searchFun = data.xpath
        searches = makeSequence(urlSearch)
        for search in searches:
            for match in searchFun(search):
                try:
                    for attrib in html_link_attrs:
                        if attrib in match.attrib:
                            searchUrls.append(match.get(attrib))
                except AttributeError:
                    searchUrls.append(str(match))
            if not cls.multipleImagesPerStrip and searchUrls:
                # do not search other links if one pattern matched
                break
        if not searchUrls:
            raise ValueError("XPath %s not found at URL %s." % (searches, url))
        return searchUrls
645985
def get_urls(self):
        
        parts = []
        seen = set()

        # Process item views in order
        for v in list(self._meta.item_views)+list(self._meta.action_views):
            if not v in seen:
                view, name = self.get_view_and_name(v)
                if view and name:
                    parts.append(self.get_url(name, view, v))
                seen.add(v)

        # Process everything else that we have not seen
        for v in set(self._views).difference(seen):
            # Get the url name
            view, name = self.get_view_and_name(v)
            if view and name:
                parts.append(self.get_url(name, view, v))

        return parts
516201
def __build_url(self, api_call, **kwargs):
        """"""
        kwargs['key'] = self.api_key
        if 'language' not in kwargs:
            kwargs['language'] = self.language
        if 'format' not in kwargs:
            kwargs['format'] = self.__format
        api_query = urlencode(kwargs)

        return "{0}{1}?{2}".format(urls.BASE_URL,
                                   api_call,
                                   api_query)
1055541
def _base_get_list(self, url, limit=None, *, query=None, order_by=None,
                       batch=None):
        

        if limit is None or limit > self.protocol.max_top_value:
            batch = self.protocol.max_top_value

        params = {'$top': batch if batch else limit}

        if order_by:
            params['$orderby'] = order_by

        if query:
            if query.has_filters:
                warnings.warn(
                    'Filters are not allowed by the Api Provider '
                    'in this method')
                query.clear_filters()
            if isinstance(query, str):
                params['$filter'] = query
            else:
                params.update(query.as_params())

        response = self.con.get(url, params=params)
        if not response:
            return iter(())

        data = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        items = (
            self._classifier(item)(parent=self, **{self._cloud_data_key: item})
            for item in data.get('value', []))
        next_link = data.get(NEXT_LINK_KEYWORD, None)
        if batch and next_link:
            return Pagination(parent=self, data=items,
                              constructor=self._classifier,
                              next_link=next_link, limit=limit)
        else:
            return items
620213
def load_collection_from_url(resource, url, content_type=None):
    
    coll = create_staging_collection(resource)
    load_into_collection_from_url(coll, url, content_type=content_type)
    return coll
1047356
function collectResources(a, obj, tagName) {
        Array.prototype
            .forEach
            .call(a.ownerDocument.getElementsByTagName(tagName), function(r) {
                // Get canonical URL
                a.href = r.currentSrc || r.src || r.getAttribute("xlink:href") || r.href;

                // only get external resource
                if (a.href.match(/^https?:\/\//)) {
                    obj[a.href] = r;
                }
            });
    }
96518
def headers_for_url(cls, url):
        """"""
        response = cls.http_request(url, method='HEAD')
        if response.status != 200:
            cls.raise_http_error(response)

        return Resource.headers_as_dict(response)
437486
def list_aggregated_resources(uri_prefix, opts = {})
      data, _status_code, _headers = list_aggregated_resources_with_http_info(uri_prefix, opts)
      return data
    end
506701
def _list_request(self):
        """"""
        try:
            # https://jolokia.org/reference/html/protocol.html
            #
            # A maxDepth of 1 restricts the return value to a map with the JMX
            # domains as keys. The values of the maps don't have any meaning
            # and are dummy values.
            #
            # maxCollectionSize=0 means "unlimited". This works around an issue
            # prior to Jolokia 1.3 where results were truncated at 1000
            #
            url = "http://%s:%s/%s%s?maxDepth=1&maxCollectionSize=0" % (
                self.config['host'],
                self.config['port'],
                self.jolokia_path,
                self.LIST_URL)
            # need some time to process the downloaded metrics, so that's why
            # timeout is lower than the interval.
            timeout = max(2, float(self.config['interval']) * 2 / 3)
            with closing(urllib2.urlopen(self._create_request(url),
                                         timeout=timeout)) as response:
                return self._read_json(response)
        except (urllib2.HTTPError, ValueError) as e:
            self.log.error('Unable to read JSON response: %s', str(e))
            return {}
964853
def url_for(self, *args: str, **kwargs: str) -> URL:
        """"""
        return self._resource.url_for(*args, **kwargs)
690458
def list(cls, params=None, custom_headers=None):
        

        if params is None:
            params = {}

        if custom_headers is None:
            custom_headers = {}

        api_client = client.ApiClient(cls._get_api_context())
        endpoint_url = cls._ENDPOINT_URL_LISTING
        response_raw = api_client.get(endpoint_url, params, custom_headers)

        return BunqResponseUserList.cast_from_bunq_response(
            cls._from_json_list(response_raw)
        )
1343378
def generate_item_urls(self):
        """"""
        item_urls = {}
        for i in self.dataset.identifiers:
            relpath = self.dataset.item_properties(i)["relpath"]
            url = self.generate_url("data/" + relpath)
            item_urls[i] = url
        return item_urls
1325336
def _get_api_urls(self, api_urls=None):
        
        view_name = self.__class__.__name__
        api_urls = api_urls or {}
        api_urls["read"] = url_for(view_name + ".api_read")
        api_urls["delete"] = url_for(view_name + ".api_delete", pk="")
        api_urls["create"] = url_for(view_name + ".api_create")
        api_urls["update"] = url_for(view_name + ".api_update", pk="")
        return api_urls
843397
def _query_api(self, params, direct=False):
        
        if not direct:
            return get(
                self.URI_BASE + self.RESOURCE_NAME, params=params, headers=self._headers
            )

        id = params.pop("id")
        return get(
            self.URI_BASE + self.RESOURCE_NAME + "/{0}".format(id),
            params=params,
            headers=self._headers,
        )
919365
def make_api_call(self, method, url, json_params=None):
        

        url = self.BRANCH_BASE_URI+url

        if self.verbose is True:
            print("Making web request: {}".format(url))

        if json_params is not None:
            encoded_params = json.dumps(json_params)
            headers = {'Content-Type': 'application/json'}
        else:
            encoded_params = None
            headers = {}

        if encoded_params is not None and self.verbose is True:
            print("Params: {}".format(encoded_params))

        request = Request(url, encoded_params.encode('utf-8'), headers)
        request.get_method = lambda: method
        response = urlopen(request).read()
        return json.loads(response.decode('utf-8'))
992811
def _construct_url(self, base_api, params):
        
        params['key'] = self.api_key
        return super(OpenMapQuest, self)._construct_url(base_api, params)