def _GetMetadataRequest(self, metadata_url, params=None): """Performs a GET request with the metadata headers. Args: metadata_url: string, the URL to perform a GET request on. params: dictionary, the query parameters in the GET request. Returns: HTTP response from the GET request. Raises: urlerror.HTTPError: raises when the GET request fails. """ headers = {'Metadata-Flavor': 'Google'} params = urlparse.urlencode(params or {}) url = '%s?%s' % (metadata_url, params) request = urlrequest.Request(url, headers=headers) return urlrequest.urlopen(request, timeout=self.timeout * 1.1)
def _GetMetadataRequest(self, metadata_url, params=None): """Performs a GET request with the metadata headers. Args: metadata_url: string, the URL to perform a GET request on. params: dictionary, the query parameters in the GET request. Returns: HTTP response from the GET request. Raises: urlerror.HTTPError: raises when the GET request fails. """ headers = {'Metadata-Flavor': 'Google'} params = urlparse.urlencode(params or {}) url = '%s?%s' % (metadata_url, params) request = urlrequest.Request(url, headers=headers) return urlrequest.urlopen(request, timeout=self.timeout*1.1)