簡體   English   中英

Apache LibCloud和Rackspace Cloudfiles

[英]Apache LibCloud and Rackspace Cloudfiles

我已經開始將Apache libcloud庫與python結合使用,以便可以與python3中的機架空間雲文件進行通信(pyrax僅2個)

我已經成功運行了這個程序,正在愉快地上傳文件/創建容器等。

不幸的是,我似乎只能獲取上傳項目的HTTP網址:

 driver.get_object_cdn_url(obj) 

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

有沒有辦法通過此庫獲取其他網址(HTTPS /流式傳輸等)(我無法從文檔中了解它!)

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

driver.enable_container_cdn(container)

沒有直接獲取流URL的方法, get_container_cdn_url僅使用靜態CDN URL進行響應。 此代碼段將直接從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']

有關詳細信息,請參見這些參考文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM