使用Bottle从Azure blob存储中下载文件

时间:2013-03-07 08:57:42

标签: python azure-storage-blobs bottle

我正在使用带有天蓝色blob存储的瓶子python:

   @route('/download/:filename')
    def getDownload(filename):
      try:
        raw = blob.get_blob('picture', filename)
        return raw

我的代码下载文件是否正确?

修改

  

你是如何实例化blob的,例如:blob = BlobService(account_name, account_key)

 blob = BlobService(account_name='xxx', account_key='O6asd7ET+ssadsadNvVLAZ46nB6iHDadavpKbJilKvy0uOJ4/g37923983991djkdjk‌​kajd==')  

更新

这不起作用:

blob = BlobService(account_name='xxx', account_key='O6asd7ET+ssadsadNvVLAZ46nB6iHDadavpKbJilKvy0uOJ4/g37923983991djkdjk‌​kajd==')  

 @route('/download/:filename')
        def getDownload(filename):
          try:
            raw = blob.get_blob('picture', filename)
            return raw

部分工作:

@route('/download/:filename')
            def getDownload(filename):
              try:
blob = BlobService(account_name='xxx', account_key='O6asd7ET+ssadsadNvVLAZ46nB6iHDadavpKbJilKvy0uOJ4/g37923983991djkdjk‌​kajd==')  
                raw = blob.get_blob('picture', filename)
                return raw

为什么呢?并且return raw给出套接字异常。

0 个答案:

没有答案