Skip to content

CloudFiles set_temp_url_key and get_temp_url_key Bug #613

Open
@bormesh

Description

@bormesh

Hi,

so I'm running into a bug when trying to get a previously set Temp_URL_Key.

I do something like the following:

cf = pyrax.cloudfiles
cf.set_temp_url_key('testurlkey')
cf.get_temp_url_key(cached=False)

'get_temp_url_key' is calling the underlying 'get_account_metadata' which returns a dictionary like this:

cf.get_account_metadata()
{'X_Account_Meta_Temp_Url_Key': 'testurlkey'}

But, the method, 'get_temp_url_key' uses the key 'temp_url_key' to index into the above returned dictionary (see below)

    def get_temp_url_key(self, cached=True):
    """
    Returns the current TempURL key, or None if it has not been set.

    By default the value returned is cached. To force an API call to get
    the current value on the server, pass `cached=False`.
    """
    meta = self._cached_temp_url_key
    if not cached or not meta:
        key = "temp_url_key"
        meta = self.get_account_metadata().get(key)
        self._cached_temp_url_key = meta
    return meta

Therefore, 'cf.get_temp_url_key' is returning None, as we're indexing by the wrong key.

Looks like a simple fix would be to change key = 'X_Account_Meta_Temp_Url_Key'.

Thanks for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions