Skip to content
Advertisement

How to create temporary URL in OpenStack using python-swiftclient?

I’m using the python-swiftclient to connect to an OpenStack Object Store. Following some examples from the documentation I can now upload a file:

JavaScript

This works great and I now want to create a temporary URL for that file. In the sources I found the function generate_temp_url(), which needs at least four arguments: path, seconds, key, method

For the path, the documentation says:

JavaScript

and I’m having trouble finding this path. I tried a couple variations (my local path, the URL of the file I get from the web interface) but nothing works. I can get the headers about the file

JavaScript

which returns this:

JavaScript

But that doesn’t show any helpful information.

In this documentation it gives the following example:

Example: /v1/AUTH_account/c/o or: http://saio:8080/v1/AUTH_account/c/o

The direct url to my file is: https://8d078638c1a547c09e0b5f34834554f1.ourobjectstore.com/new-container/file.txt

So that doesn’t resemble the URLs in the example at all.

What is happening here? Where can I find this so called “path” so that I can create the temp URL?

Advertisement

Answer

In the end @RakshaSaini wrote the first comment pointing me to the official documentation here. It contained an example which didn’t work, but was close enough. I adjusted it as follows and now it works for us:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement