【发布时间】:2018-11-10 02:05:45
【问题描述】:
class FileDropboxDownloadView(LoginRequiredMixin, View):
login_url = global_login_url
def get(self, request, pk):
# return self.head(self)
# use the path to find the filename
db_query_file = self.request.path
# remove the trailing slash
db_query_file = db_query_file[:-1]
# regular expressions to remove the beginning
db_query_file = re.sub('^(/)[\w]+(/)[\w]+', '', db_query_file)
dbx = dropbox.Dropbox(dropbox_token)
return dbx.files_download(db_query_file, rev=None)
当我尝试这个时,它只会给我文件的元数据,而不是文件本身。有没有办法让它返回文件?谢谢!
【问题讨论】:
标签: django get httprequest dropbox