GithubHelp home page GithubHelp logo

alist-'s Introduction

使用Alist云盘挂载程序API接口上传文件到云盘(阿里云盘等)

import requests
from requests_toolbelt import MultipartEncoder
from urllib.parse import quote

url = "http://xxxxxx:5244/api/fs/form"

filename = 'xxxx'  #需要上传的文件

data = MultipartEncoder(
    fields={
        'file': (filename, open(filename, 'rb'))
    }
)

filename_new = quote(filename,'utf-8')  #对文件名进行URL编码

headers = {
   'Authorization':'xxxxxxxx',
   'Content-Type':data.content_type,
   'file-path':'/Alidrive/filename_new'    #上传到云盘的位置以及文件名(填写的文件名必须是URL编码后的)
}

res = requests.put(url=url,data=data,headers=headers)
print(res.text)

上传成功的反馈

image

引用帖子

https://zhuanlan.zhihu.com/p/587004798 alist-org/alist#1349

alist-'s People

Contributors

1136623363 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.