{ "info": { "author": "ZhangTianJie", "author_email": "ztj1993@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Python ConfigFile Package\n\n## \u8bf4\u660e\n\u8fd9\u662f\u4e00\u4e2a Python \u914d\u7f6e\u6587\u4ef6\u52a0\u8f7d\u6a21\u5757\uff0c\u4e3b\u8981\u89e3\u51b3 yaml, json \u914d\u7f6e\u6587\u4ef6\u7684\u5feb\u901f\u52a0\u8f7d\u3002\n\n## \u4f9d\u8d56\n```\npip install PyYAML==5.1.2\n```\n\n## \u4f7f\u7528\n```\nimport os.path\nfrom configfile import ConfigFile\n\n\nconfig_dir = os.path.dirname(os.path.abspath(__file__))\nconfigfile = ConfigFile(config_dir)\n\n# \u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\nprint(configfile.load('config'))\n\n# \u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\nprint(configfile.load('config', '/srv/config'))\n```\n\n## \u914d\u7f6e\u6587\u4ef6\u5b9a\u671f\u52a0\u8f7d\n```\nimport json\nimport time\nimport os.path\n\nfrom framework.configfile.configfile import ConfigFile\n\ntimestamp1 = time.time()\ntimestamp2 = False\n\nconfig_dir = os.path.dirname(os.path.abspath(__file__))\nconfigfile = ConfigFile(config_dir)\n\n\ndef callback():\n global timestamp1\n global timestamp2\n if timestamp2 is False:\n timestamp2 = timestamp1\n else:\n timestamp2 = time.time()\n return json.dumps({\"timestamp\": timestamp2})\n\n\nfile_path = configfile.get_file_path('expire', configfile.json_suffix)\nprint(configfile.expire(file_path, callback, 3))\nprint(configfile.load('expire'))\ntime.sleep(1)\nprint(configfile.expire(file_path, callback, 3))\nprint(configfile.load('expire'))\ntime.sleep(3)\nprint(configfile.expire(file_path, callback, 3))\nprint(configfile.load('expire'))\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ztj1993/PythonPackages/blob/master/config_file", "keywords": "configfile config json yaml", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "py-ztj-configfile", "package_url": "https://pypi.org/project/py-ztj-configfile/", "platform": "", "project_url": "https://pypi.org/project/py-ztj-configfile/", "project_urls": { "Homepage": "http://github.com/ztj1993/PythonPackages/blob/master/config_file" }, "release_url": "https://pypi.org/project/py-ztj-configfile/0.0.1/", "requires_dist": [ "PyYAML" ], "requires_python": "", "summary": "python configuration file loading package", "version": "0.0.1" }, "last_serial": 5779528, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "f99c360fe2f464e3ed14b1bdc507118e", "sha256": "6be277086c7e93cc5de4c149049587aacc34b4e74fc4948694531fad38596351" }, "downloads": -1, "filename": "py_ztj_configfile-0.0.1-20190904062737-py3-none-any.whl", "has_sig": false, "md5_digest": "f99c360fe2f464e3ed14b1bdc507118e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1746, "upload_time": "2019-09-04T06:27:47", "url": "https://files.pythonhosted.org/packages/d2/5d/097837478a5d91df0dcb92b3fb436dff24fb415ab8499f464fe86bc1bb2a/py_ztj_configfile-0.0.1-20190904062737-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f99c360fe2f464e3ed14b1bdc507118e", "sha256": "6be277086c7e93cc5de4c149049587aacc34b4e74fc4948694531fad38596351" }, "downloads": -1, "filename": "py_ztj_configfile-0.0.1-20190904062737-py3-none-any.whl", "has_sig": false, "md5_digest": "f99c360fe2f464e3ed14b1bdc507118e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1746, "upload_time": "2019-09-04T06:27:47", "url": "https://files.pythonhosted.org/packages/d2/5d/097837478a5d91df0dcb92b3fb436dff24fb415ab8499f464fe86bc1bb2a/py_ztj_configfile-0.0.1-20190904062737-py3-none-any.whl" } ] }