如何以编程方式将 url 保存到保管箱中的文件?
How can I take url to a file, which is on dropbox, programmatically?
这是我的代码:
from main import settings
import dropbox
def create(request):
if request.method == "POST":
image = request.FILES['image']
dbx = dropbox.Dropbox(settings.DROPBOX_ACCESS_TOKEN)
imageName = "{}.{}".format(uuid.uuid4(), image._name.split('.')[-1])
path = settings.DROPBOX_FOLDER + imageName
response = dbx.files_upload(image, path)
如何在变量 'image_url' 中获取 url 图像?
听起来您正在寻找 sharing_create_shared_link method in the Dropbox Python SDK。
基本思路可能是这样的:
dbx.sharing_create_shared_link(path)
这是我的代码:
from main import settings
import dropbox
def create(request):
if request.method == "POST":
image = request.FILES['image']
dbx = dropbox.Dropbox(settings.DROPBOX_ACCESS_TOKEN)
imageName = "{}.{}".format(uuid.uuid4(), image._name.split('.')[-1])
path = settings.DROPBOX_FOLDER + imageName
response = dbx.files_upload(image, path)
如何在变量 'image_url' 中获取 url 图像?
听起来您正在寻找 sharing_create_shared_link method in the Dropbox Python SDK。
基本思路可能是这样的:
dbx.sharing_create_shared_link(path)