def get_temp_url(self, container, obj, seconds, method="GET", key=None,
            cached=True):
        """
        Given a storage object in a container, returns a URL that can be used
        to access that object. The URL will expire after `seconds` seconds.

        The only methods supported are GET and PUT. Anything else will raise
        an `InvalidTemporaryURLMethod` exception.

        If you have your Temporary URL key, you can pass it in directly and
        potentially save an API call to retrieve it. If you don't pass in the
        key, and don't wish to use any cached value, pass `cached=False`.
        """
        if not key:
            key = self.api.get_temp_url_key(cached=cached)
        if not key:
            raise exc.MissingTemporaryURLKey("You must set the key for "
                    "Temporary URLs before you can generate them. This is "
                    "done via the `set_temp_url_key()` method.")
        cname = utils.get_name(container)
        oname = utils.get_name(obj)
        mod_method = method.upper().strip()
        if mod_method not in ("GET", "PUT"):
            raise exc.InvalidTemporaryURLMethod("Method must be either 'GET' "
                    "or 'PUT'; received '%s'." % method)
        mgt_url = self.api.management_url
        mtch = re.search(r"/v\d/", mgt_url)
        start = mtch.start()
        base_url = mgt_url[:start]
        path_parts = (mgt_url[start:], cname, oname)
        cleaned = (part.strip("/\\") for part in path_parts)
        pth = "/%s" % "/".join(cleaned)
        expires = int(time.time() + int(seconds))
        try:
            key = key.encode("ascii")
            hmac_body = b'\n'.join([
                mod_method.encode("ascii"),
                six.text_type(expires).encode("ascii"),
                pth.encode("ascii")])
        except UnicodeEncodeError:
            raise exc.UnicodePathError("Due to a bug in Python, the TempURL "
                    "function only works with ASCII object paths.")
        sig = hmac.new(key, hmac_body, hashlib.sha1).hexdigest()
        temp_url = "%s%s?temp_url_sig=%s&temp_url_expires=%s" % (base_url, pth,
                sig, expires)
        return temp_url