Skip to main content

python configuration file loading package

Project description

Python ConfigFile Package


这是一个 Python 配置文件加载模块,主要解决 Ymal, Json 配置文件的快速加载,同时支持网络配置动态加载。


from configfile import ConfigFile

configfile = ConfigFile('config_dir')



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
        timestamp2 = time.time()
    return json.dumps({"timestamp": timestamp2})

print(configfile.load_dynamic_json('config', callback, 3))
print(configfile.load_dynamic_json('config', callback, 3))
print(configfile.load_dynamic_json('config', callback, 3))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
py_configfile-0.0.4-py3-none-any.whl (3.3 kB) Copy SHA256 hash SHA256 Wheel py3
py_configfile-0.0.4.tar.gz (2.2 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page