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')

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))

Project details


Download files

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

Source Distribution

py_configfile-0.0.4.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

py_configfile-0.0.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file py_configfile-0.0.4.tar.gz.

File metadata

  • Download URL: py_configfile-0.0.4.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for py_configfile-0.0.4.tar.gz
Algorithm Hash digest
SHA256 545665c3ebdde2956a238093f83f51d7685622976b26a304812868a10c05da5e
MD5 f25a399fcc7b73c2d08adfba7a1671ab
BLAKE2b-256 5b95d8b35f0540ac1e57d3bb08065e4fbf4519d1d79dd0e99d27718167f94231

See more details on using hashes here.

File details

Details for the file py_configfile-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: py_configfile-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for py_configfile-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 364246dc9ab5cccdf526237257a13ab3b8e4f04faca361c57fd0c01bdc922370
MD5 f998dfb4ae0b4e9b374f552f44bfa5d4
BLAKE2b-256 c9c64aeb6066233de25be9eab5601e67071eba3e8db4b9da7afcb74f74a64d4c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page