Skip to content

Commit 723291a

Browse files
Fix README re-explaining how to use the project
1 parent 971045e commit 723291a

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# python-json-config-parser
2-
Project created to give the possibility of create dynamics Json config files and use this using oriented object paradigm
2+
This project was created to give you the possibility of creating json config files dynamicaly using OOP
33

44
HOW TO INSTALL
55
---------------------------
@@ -10,11 +10,11 @@ pip install python-json-config-parser
1010
```
1111

1212

13-
HOW IT WORKS
13+
HOW TO USE
1414
---------------------------
15-
The Class Config takes two arguments, The first is a Schema(https://github.com/keleshev/schema) to secure the model of config,
16-
the second is the str path of json config file.
17-
If the second argument didn't take, the default value('./config.json') is used when you call Config Class trying find this file in the same dir file where you call this Class.
15+
The Class Config takes two arguments, the first is a Schema(https://github.com/keleshev/schema) to secure the model of config, the second is the str path of json config file.
16+
17+
If you don't specify the path, the default value('config.json') will be used if one exists in the same dir where the script is running.
1818

1919
For example:
2020

@@ -30,7 +30,7 @@ SCHEMA_CONFIG = {
3030
},
3131
"allowed_clients":[
3232
{
33-
"ip":str, # <- Here you can use regex to valid the ip format
33+
"ip":str, # <- Here you can use regex to validate the ip format
3434
"timeout":int
3535
}
3636
]
@@ -73,11 +73,16 @@ except ConfigException as e:
7373
exit()
7474
7575
#to access your config you need just:
76+
77+
78+
fmt = config.core.logging.format #look this, at this point I'm already using the config variable
79+
dtfmt = config.core.logging.datefmt #here again
80+
7681
logging.getLogger(__name__)
7782
7883
logging.basicConfig(
79-
format=config.core.logging.format, #look this, at this point I'm already using the config variable
80-
datefmt=config.core.logging.datefmt, #here again
84+
format=fmt,
85+
datefmt=dtfmt
8186
level=20
8287
)
8388
@@ -89,7 +94,7 @@ for client in config.core.allowed_clients:
8994
9095
```
9196

92-
After of create the fist obj you don't need to pass the args again, you can instance of Config in other files of your project
97+
Instanced the first obj, you can instance Config in other files of your project
9398
just calling the Config without args like that:
9499

95100
```

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="python-json-config-parser",
8-
version="1.0.4",
8+
version="1.0.5",
99
author="Bruno Silva de Andrade",
1010
author_email="brunojf.andrade@gmail.com",
1111
description="Project created to given the possibility of create dynamics Json config files",

0 commit comments

Comments
 (0)