Package: lskyup
▄█▄████████▄█▄█▄▄██▄████▄▄███████▄
████████████▄███▀█████▄████████████
███████▀███▐██▀███▄▄▄███████████████
██████▄█████▀▀▀▀▀▀▀███████████████
███▀███████████▀▀█████▄▄███████████▀█████████▀
█████████▐██▄███████████████
███▌▄▄███████▀███▄███████████████
█████▄▄██▄████████▀███▀█▀▀█████▀████████▀▄████▀
▀▀LskyUp介绍一个使用Python实现命令行上传图片到LskyPro图床，以及命令行查看LskyPro用户储存情况的小工具目录背景原理安装使用完整命令帮助列表lskyup config获取tokenlskyup --versionlskyup --infolskyup --userlskyup uploadlskyup upload --help不压缩上传压缩后上传lskyup cleanChange LogLICENSE背景最近在自己的服务器上搭建了一个LskyPro图床，想配合Typora+Picgo一起实现博客图片解决方案，但是Picgo现有的插件在我的自建服务上均会报错，所以抽空用Python写了这个命令行程序原理使用Python的Click库来创建命令行CLI工具使用Python的requests库来发送GET和POST请求实现上传和参数的返回使用Python的os、json库来实现路径的获取、拼接和文件的读取写入图片压缩的算法参考了这个项目Luban-Py安装使用pip包管理工具安装pipinstalllskyup使用完整命令帮助列表❯lskyup--help
Usage:lskyup[OPTIONS]COMMAND[ARGS]...

Options:-i,--infoShowthecurrenttoken&serverinformation-v,--versionShowtheversioninformation-u,--userShowtheUserinformation--helpShowthismessageandexit.

Commands:cleanCleanImgCacheconfigConfigyourserverurlandapitokenuploadUploadtheimageslskyup config配置Server和Token❯lskyupconfig
lskyupCopyright(C)2023-nowJoeZhu
LICENSEGPL-V3
PleaseenteryourLskyserver'surl:https://example.com/api/v1
PleaseenteryourownLskytoken:Bearerx|xxxxxxxxxxxxxxxxxxxxxxxxxxx配置文件位于用户根目录/lskyup/config.json获取tokencurl-XPOST\-d"email=youremail@example.com&password=yourpassword"\-H"Accept: application/json"\https://example.com/api/v1/tokens返回值是json格式的，token位于data.token，格式是x|xxxxxxxxxxxxxxxxxxxxxxtoken在输入之前请自行加上Bearer(注意中间有一个空格)lskyup --version输出当前工具版本等信息▄█▄████████▄█▄█▄▄██▄████▄▄███████▄
████████████▄███▀█████▄████████████
███████▀███▐██▀███▄▄▄███████████████
██████▄█████▀▀▀▀▀▀▀███████████████
███▀███████████▀▀█████▄▄███████████▀█████████▀
█████████▐██▄███████████████
███▌▄▄███████▀███▄███████████████
█████▄▄██▄████████▀███▀█▀▀█████▀████████▀▄████▀
▀▀Version0.1.2©JoeZhuALLRIGHTSRESERVEDLICENSEGPL-V3CONTACT:zhuzhouyue2005@outlook.comlskyup --info输出当前的配置信息❯lskyup--info
Server:https://example.com/api/v1
Token:Bearerx|xxxxxxxxxxxxxxxxxxxxxxxxxxxlskyup --user输出当前配置用户的信息❯lskyup--user
USERINFORMATION
Username:Username
E-mail:example@example.com
Website:https://example.com
ImageNumbers:30AlbumNumbers:0StorageUsed/Total:55122.47KB/51200000KBlskyup uploadlskyup upload --helpupload子命令帮助列表❯lskyupupload--help
lskyupCopyright(C)2023-nowJoeZhu
LICENSEGPL-V3
Usage:lskyupupload[OPTIONS][IMG]...Uploadtheimages

Options:-c,--compressCompressyourImagesbeforeuploading--helpShowthismessageandexit.不压缩上传lskyup upload /img1 /img2 /img3不压缩上传图片，返回图片访问url，支持多张图片（路径之间一个空格）❯lskyupupload/img1/img2/img3lskyupCopyright(C)2023-nowJoeZhu
LICENSEGPL-V3
UploaderisProcessing:
UploaduncompressedImg[####################################]  100%UploadSuccess:
https://example.com/i/2023/05/01/644fsdf6eb1bf.webp
https://example.com/i/2023/05/01/3f4fb1d6eb10d.jpg
https://example.com/i/2023/05/01/a6f4fb12hb15f.png压缩后上传lskyup upload -c /img1 /img2 /img3压缩后上传图片（增加参数--compress）返回图片访问url，同样支持多张图片（路径之间一个空格）压缩后的图像缓存在用户根目录/lskyup/Img_cache中❯lskyupupload-c/img1/img2/img3lskyupCopyright(C)2023-nowJoeZhu
LICENSEGPL-V3
UploaderisProcessing:
UploadcompressedImg[####################################]  100%UploadSuccess:
https://example.com/i/2023/05/01/644fsdf6eb1bf.webp
https://example.com/i/2023/05/01/3f4fb1d6eb10d.jpg
https://example.com/i/2023/05/01/a6f4fb12hb15f.pnglskyup clean清理压缩图片缓存（删除用户根目录/lskyup/Img_cache文件夹）❯lskyupclean
lskyupCopyright(C)2023-nowJoeZhu
LICENSEGPL-V3
CleanImg_cachesuccessfullyChange Logv0.1.4 (2023.5.1 23:01 GMT +8)修复了一些细小的问题v0.1.3 (2023.5.1 22:33 GMT +8)更新了README.md修复了一些细小的问题v0.1.2 (2023.5.1 21:38 GMT +8)第一个可以用的版本LICENSEGPLv3+© Zhouyue Zhu