7niu使用python下载图片,解析文件正确,但是无法下载

# -*- coding: utf-8 -*-
# flake8: noqa
import os
import string
import random
import tempfile
import requests

from qiniu.compat import is_py2, b
from qiniu.services.storage.uploader import _form_put
from qiniu import Auth
from qiniu import BucketManager

access_key = 'ooooo'
secret_key = 'xxx'
bucket_name = 'faveface'
url_base = '7xj2tu.com1.z0.glb.clouddn.com'

print access_key
print secret_key

q = Auth(access_key, secret_key)

def list_all(bucket_name, bucket=None, prefix=None, limit=None):
    print('List file...')
    if bucket is None:
        bucket = BucketManager(q)
    marker = None
    print(bucket);
    eof = False
    while eof is False:
        ret, eof, info = bucket.list(bucket_name, prefix=prefix, marker=marker, limit=limit)
        marker = ret.get('marker', None)
        for item in ret['items']:
#            print(item['key']+'.jpg')
#            base_url='http://%s//%s'%(url_base,item['key']+'.jpg')
            base_url='http://%s//%s'%(bucket_name+'.qiniudn.com',item['key']+'.jpg')
            print('Processing: '+base_url);
            private_url = q.private_download_url(base_url,expires=3600)
            print(private_url)
            #r = requests.get(private_url)
            #assert r.status_code == 200


list_all(bucket_name)


代码如上,access_key ,secret_key 暂时匿名了,打算下载faveface中的图片,能够list出图片,但是下载出现问题,大神么帮帮忙哈。

查看回复