Python - Looking for a demo of Qiniu Cloud remote image uploading
代言
代言 2017-06-12 09:26:44
0
1
837

Beginner learning python When using scrapy to collect web page images, the other party will prohibit cross-domain display, so I came up with the idea of ​​saving the images on Qiniu Cloud, but the python API of Qiniu Cloud is a bit confusing, so I came here I would like to ask if there is a demo for saving remote pictures to Qiniu Cloud. If so, can you post it for reference and study? Thank you very much!

代言
代言

reply all(1)
女神的闺蜜爱上我
from qiniu import Auth, BucketManager
# 抓取文件到七牛
def fetch(url):
    filename = str(time.time()).replace('.', '')
    # 获取鉴权对象
    auth = Auth(access_key, secret_key)
    # 初始化BucketManager
    bucket_manager = BucketManager(auth)
    ret, info = bucket_manager.fetch(url, bucket_name, filename)
    if info.status_code == 200:
        file_url = bucket_domain + filename
        return file_url
    else:
        return False
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!