

def get_temp_url(self, container, obj, seconds, method='GET', key=None, cached=True):
    "\n        Given a storage object in a container, returns a URL that can be used\n        to access that object. The URL will expire after `seconds` seconds.\n\n        The only methods supported are GET and PUT. Anything else will raise\n        an `InvalidTemporaryURLMethod` exception.\n\n        If you have your Temporary URL key, you can pass it in directly and\n        potentially save an API call to retrieve it. If you don't pass in the\n        key, and don't wish to use any cached value, pass `cached=False`.\n        "
    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(cleaned)
    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('/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))
    if isinstance(pth, six.string_types):
        pth = pth.encode(pyrax.get_encoding())
    expires = int((time.time() + int(seconds)))
    hmac_body = ('%s\n%s\n%s' % (mod_method, expires, pth))
    try:
        sig = hmac.new(key, hmac_body, hashlib.sha1).hexdigest()
    except TypeError as e:
        raise exc.UnicodePathError('Due to a bug in Python, the TempURL function only works with ASCII object paths.')
    temp_url = ('%s%s?temp_url_sig=%s&temp_url_expires=%s' % (base_url, pth, sig, expires))
    return temp_url

dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py ContainerManager.get_temp_url/VarMisuse@75/342 `container`->`cleaned`