Openstacks python swift client instructions

Some quick examples of how to do:

swift --os-username myuser --os-password mypassword --auth https://identity.se.storage.citycloud.com/v2.0/ --os-tenant-id myprojectid list

f in the above line you replace "myuser", "mypassword" and "myprojectid" to match the user you have created, it should work. You will find all parts on the page in the City Control Panel where you handle the swift api. (Right now in the interface that is live,  urlhttps://citycontrolpanel.com/openstack#openstack_api_access)
Click on the swift api tab and you will find information about which projectID you have in swift and you can create users if you have not already done so.
As you can see in the command line above, it is "list" that is run. Which then will list which containers you have. Then you can run list on a specific container ("mycontainer" in this example):

swift --os-username myuser --os-password mypassword --auth https://identity.se.storage.citycloud.com/v2.0/ --os-tenant-id myprojectid list mycontainer

More examples:

Upload a file or folder to "mycontainer":

swift --os-username myuser --os-password mypassword --auth https://identity.se.storage.citycloud.com/v2.0/ --os-tenant-id myprojectid upload mycontainer < path>

Download a file:

swift --os-username myuser --os-password mypassword --auth https://identity.se.storage.citycloud.com/v2.0/ --os-tenant-id myprojectid download mycontainer <file name>

Delete a file:

swift --os-username myuser --os-password mypassword --auth https://identity.se.storage.citycloud.com/v2.0/ --os-tenant-id myprojectid delete mycontainer <file name>


Then you don't need to send it on the command line but you can set it as an environment variable, you can also request an auth token and then send with it in subsequent requests, etc. If you are interested in swift's API, then you can run the swift client with "--debug", and you will see which headers and urls are used in each request you make. Quite a convenient way to see what curl calls look like, get auth-keys, etc.


Sen behöver man ju inte skicka det på command line utan du kan sätta det som environment variabel, du kan även begära en auth token och sen skicka med den i efterföljande requests, osv.

Om du är intresserad av swifts API, så kan du köra swift-klienten med "--debug", så kommer du se vilka headers och urls som används i varje request som du gör. Rätt smidigt sätt att se hur curl-anropen ser ut, få ut auth-keys, osv.