2016-08-14 101 views
0

我使用Apache libcloud庫蟒蛇,讓我跟Rackspace公司cloudfiles在python3啓動(pyrax爲2只)阿帕奇LibCloud和Rackspace Cloudfiles

我有了這個成功運行和我上傳文件/愉快地創造容器等。

可悲的是,我似乎只能夠獲得HTTP網址上傳的項目:

driver.get_object_cdn_url(obj)

這將返回HTTP網址我剛剛上傳的對象。

有沒有辦法通過這個庫得到其他網址(HTTPS /流媒體等)(我不能從文檔捉摸吧!)

回答

0

的驅動程序允許您首先啓用CDN功能在容器上。

driver.enable_container_cdn(container) 

沒有獲得直接的流網址的方法,get_container_cdn_url只與靜態的URL CDN響應。此代碼段將直接從API獲取信息:

from libcloud.utils.py3 import urlquote 
container_name = '<your container name' 
response = driver.connection.request('/%s' % (urlquote(container_name)), 
             method='HEAD', 
             cdn_request=True) 
uri = response.headers['x-cdn-uri'] 
ssl_uri = response.headers['x-cdn-ssl-uri'] 
stream_uri = response.headers['x-cdn-streaming-uri'] 

有關詳細信息,請參閱these reference docs