Python ConfigFile Package
说明
这是一个 Python 配置文件加载模块,主要解决 Ymal, Json 配置文件的快速加载,同时支持网络配置动态加载。
使用
from configfile import ConfigFile
configfile = ConfigFile('config_dir')
print(configfile.load_app('config'))
print(configfile.load_app_json('config'))
加载动态配置
import json
import time
from configfile import ConfigFile
timestamp1 = time.time()
timestamp2 = False
configfile = ConfigFile('config_dir)
def callback():
global timestamp1
global timestamp2
if timestamp2 is False:
timestamp2 = timestamp1
else:
timestamp2 = time.time()
return json.dumps({"timestamp": timestamp2})
print(configfile.load_dynamic_json('config', callback, 3))
time.sleep(1)
print(configfile.load_dynamic_json('config', callback, 3))
time.sleep(3)
print(configfile.load_dynamic_json('config', callback, 3))
Metadata
Release files for py-configfile 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_configfile-0.0.4.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_configfile-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / py_configfile-0.0.4.tar.gz
| Download URL | py_configfile-0.0.4.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
545665c3ebdde2956a238093f83f51d7685622976b26a304812868a10c05da5e
|
|
BLAKE2b-256 checksum How to use checksums |
5b95d8b35f0540ac1e57d3bb08065e4fbf4519d1d79dd0e99d27718167f94231
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|
Release files / py_configfile-0.0.4-py3-none-any.whl
| Download URL | py_configfile-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
364246dc9ab5cccdf526237257a13ab3b8e4f04faca361c57fd0c01bdc922370
|
|
BLAKE2b-256 checksum How to use checksums |
c9c64aeb6066233de25be9eab5601e67071eba3e8db4b9da7afcb74f74a64d4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
|