def _url_to_obj_ids(self, url): rv = {} rp = self.connection.request_path path = urlparse.urlparse(url).path if path.startswith(rp): # remove version string stuff path = path[len(rp):] chunks = path.split('/')[1:] for i in range(0, len(chunks), 2): key = self._plural_to_singular(chunks[i]) + '_id' key = to_underscore_separated(key) rv[key] = chunks[i + 1] return rv
def _url_to_obj_ids(self, url): rv = {} path = urlparse.urlparse(url).path # removed duplicated slashes path = path.replace('//', '/') chunks = path.split('/')[1:] # We start from 2 because we want to ignore version and tenant id # which are firest and second part of the url component for i in range(2, len(chunks), 2): chunk = chunks[i] if not chunk: continue key = self._plural_to_singular(chunk) + '_id' key = to_underscore_separated(key) rv[key] = chunks[i + 1] return rv