Solution Ali cloud oss python SDK upload and download files error

# -*- coding: utf-8 -*-
import oss2

# Aliyun primary account number AccessKey have access to all of the API, the risk is high. It is strongly recommended that you create an account and use the RAM API access or daily operation and maintenance, please login https://ram.console.aliyun.com create a RAM account.
= oss2.Auth the auth ( )'<yourAccessKeyId>', '<yourAccessKeySecret>'

A Case Study # Endpoint, other Region, please fill in the actual situation.
bucket = oss2.Bucket (auth, 'http://oss-cn-shanghai.aliyuncs.com ', 'meilinimage')

# <YourLocalFile> added by the local file path name including a suffix, e.g. /users/local/myfile.txt
bucket.put_object_from_file ( 'fang.jpg', '/ the Users / AppData / the Local / Programs / the Python / Python37 / Fang. jpg ') 

 The file path to the default installation path of Python, this problem can be solved

As shown above, fang.jpg has been successfully uploaded to the cloud Ali oss

Guess you like

Origin www.cnblogs.com/fangjianyi/p/11110789.html