自更新使用说明
- 将本模块编译成wheel
python setup.py bdist_wheel
- 在需要子更新的项目中安装wheel
pip install 打包的wheel.wheel
- 两种使用方式
- (第一种,直接使用直链)
项目中使用
from auto_update import AutoUpdate
from settings import SETTINGS
AutoUpdate(direct_url="直链url", callback).check_update()
# 关于callback参数,是一个下载回调函数,接受两个参数,第一个是文件总大小,第二个是已下载的文件大小,可以使用这个做进度条的定制
- (第二种,使用配置文件)
编写项目settings.py文件(名字可随意)
SETTINGS = {
"mode": "check_on_start", # 更新模式,目前仅支持启动时检查
"url": "http://192.168.2.17:8080/version_update_info", # 返回更新信息json的url
"update_mode": "silent" # 目前仅支持静默更新
}
更新信息格式,(可使用flask返回json数据)
{
"download_url": "http://192.168.2.17:8080/download", // 下载路径
"version": "3.0.0", // 版本信息
"md5": "md5_text", // md5
"force": True, // 是否强更
"filename": "provide_file_path" // 文件名,重要,需要与客户端文件名一致
}
项目中使用
from auto_update import AutoUpdate
from settings import SETTINGS
AutoUpdate(SETTINGS, callback[可选]).check_update()
Metadata
Release files for auto-update-by-hamu 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| auto-update-by-hamu-0.0.5.tar.gz | 3.9 kB | Without provenance | Details for auto-update-by-hamu-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| auto_update_by_hamu-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for auto_update_by_hamu-0.0.5-py3-none-any.whl |
Total release size: 8.2 kB
Release files / auto-update-by-hamu-0.0.5.tar.gz
| Download URL | auto-update-by-hamu-0.0.5.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d174baa401001a0201bf2d66c2dcc45af22c07fa2525d11b0d6ff48e2fa976
|
|
BLAKE2b-256 checksum How to use checksums |
8b3a80139052d7ee4f7362361d20fde2803dbb1251a26922f0f70a86c5150b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0rc2
|
Release files / auto_update_by_hamu-0.0.5-py3-none-any.whl
| Download URL | auto_update_by_hamu-0.0.5-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f045574c77e61b2370afeb2b391c75e2cad6ed279415cd83d00bf2813d4c7b24
|
|
BLAKE2b-256 checksum How to use checksums |
33d0aa83c8ff3429454639469a589415ecdf83baf4b963549724cdc765cc7ff2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0rc2
|
Security for auto-update-by-hamu 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.