Rackspace's officially supported python sdk is Pyrax - unfortunately it doesn't work with python3. There is the alternative apache module called libcloud
but that is tricky to get working on windows.
Rackspace has a publically available api that can be used to manually send requests to your cloud files. All it requires is an existing container, a username, and an api key
To do this we will issue an initial request to rackspace with our credentials. Rackspace will then issue us a temporary token, and a list of services and urls to communicate with. We will pull our token and the cloudfiles services from this response and grab the url for our containers region (ie: DFW). Combine that url with our container and desired filename and we have the url we will upload our file to.
Setup the headers with our temporary token and content type and open the file we wish to send.
There are two important things to note at this point
- We need to open in 'rb' mode because we are sending this file (opening in unicode mode seemed to always fail from my testing)
- We opened the file without reading it, but requests will handle sending the file data for us anyway
This is the basic upload process without using pyrax, no frills here though so use with caution!
thanks! still works.