如何将url带到dropbox上的文件,programaticaly?

时间:2022-03-03 10:16:37

Here is my code:

这是我的代码:

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)

How can I take url of image in a variable 'image_url'? Sorry for my English.

如何在变量'image_url'中获取图像的网址?对不起我的英语不好。

1 个解决方案

#1


1  

It sounds like you're looking for the sharing_create_shared_link method in the Dropbox Python SDK.

听起来你正在寻找Dropbox Python SDK中的sharing_create_shared_link方法。

The basic idea would likely be something like:

基本想法可能是这样的:

dbx.sharing_create_shared_link(path)

#1


1  

It sounds like you're looking for the sharing_create_shared_link method in the Dropbox Python SDK.

听起来你正在寻找Dropbox Python SDK中的sharing_create_shared_link方法。

The basic idea would likely be something like:

基本想法可能是这样的:

dbx.sharing_create_shared_link(path)