数码资讯
利用Python实现Picgo图床工具
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
目录
- 一、PyPicGo
- 1、安装
- 2、配置
- 3、使用
- 4、支持的图床
- 5、支持的插件
- 6、Uploader上传器
- 7、插件系统
- 8、开发
一、PyPicGo
PyPicGo 是一款图床工具,是PicGo是Python版实现,并支持各种插件自定义插件,目前PyPicGo自带了gitee、github、SM.MS和七牛云图传,以及rename、notify和typora等插件,并支持从pypi中下载其他插件和Uploader
源码地址:
【gitee】https://gitee.com/Ranger313/pypicgo
【github】https://github.com/AnsGoo/PyPicGo
1、安装
pip install pypicgo
2、配置
配置文件位于/$HOME/.PyPicGo/config.yml目录下,采用YAML的方式进行配置。必须配置上传器uploader,插件plugins的数量可选
default: # 默认配置 uploader: gitee # 默认图床 plugins: # 全局插件 - module: pypicgo.plugins.rename.ReNamePlugin # 图床插件加载地址 config: format: liunx{hash}chenghaiwen{date}-{filename} - module: pypicgo.plugins.typora.TyporaPlugin - module: pypicgo.plugins.compress.CompressPlugin - module: pypicgo.plugins.notify.NotifyPlugin uploaders: # 可用图床 smms: # sm.ms图床配置 module: pypicgo.uploaders.smms.uploader.SmmsUploader config: secret_token: xxx gitee: # gitee 图床配置 module: pypicgo.uploaders.gitee.uploader.GiteeUploader config: domain: https://gitee.com owner: xxx repo: xxx img_path: xxx access_token: xxx plugins: github: # github图床配置 module: pypicgo.uploaders.github.uploader.GithubUploader config: domain: https://api.github.com owner: xxx repo: xxx img_path: xxx oauth_token: xxx plugins: # github 图床私有插件 - module: pypicgo.plugins.jsdelivr.JsDelivrPlugin qiniu: #七牛云图床配置 moduele: pypicgo.uploaders.qiniu.uploader.QiNiuUploader config: domain: http://demo.pypicho.com/ bucket_name: pypicgo apis: - http://up-z1.qiniup.com access_key: xxx secret_key: xxxx
更多的配置说明参考文档
3、使用
帮助信息
?1pypicgo -h
上传文件
?1pypicgo -f picture1 picture2 ...
指定上传图床
?1pypicgo -n github -f picture1 picture2 ...
如果系统找不到pypicgo,请检查python的Scripts文件夹是否被加入Path环境变量
4、支持的图床
5、支持的插件
6、Uploader上传器
uploader是具体的上传插件,用户需要继承pypicgo.core.base.uploader.CommonUploader并实现upload方法,然后在配置文件中引用即可.
7、插件系统
PyPicgo支持的插件分为三种before、after和final
如果想自定义插件只要根据要求继承任意一个基类插件,并实现execute方法,并在config.yml中配置即可使用.
8、开发
?123456789git clone git@github.com:AnsGoo/PyPicGo.git cd pypicgo pipenv shell pipenv install python run.py -n 图床名 -f img1.jpg img2.jpg
到此这篇关于 利用Python实现Picgo图床工具的文章就介绍到这了,更多相关Python实现Picgo图床工具内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章:- Python对接PicGo实现图片自动加水印并上传操作示例
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。