Commit 4ac6224e8bfc5ae0d8ddcffb953f020331e873b1
1 parent
a66c87a7
changed extension of example config file and updated all references accordingly
Showing
3 changed files
with
10 additions
and
10 deletions
README.md
@@ -38,10 +38,10 @@ point / template to implement you own custom logic directly. It contains a | @@ -38,10 +38,10 @@ point / template to implement you own custom logic directly. It contains a | ||
38 | number of examples of the implemented direct and config-based method to start. | 38 | number of examples of the implemented direct and config-based method to start. |
39 | 39 | ||
40 | To run the config-file implementation of the client create a config file named | 40 | To run the config-file implementation of the client create a config file named |
41 | -`duo_api.conf` in the same directory as the script using the provided template | ||
42 | -`duo_api.tmpl` and configure it for your environment and run it. To use it | ||
43 | -without config file, comment out the settings and code provided for that, set | ||
44 | -the configuration values for your environment and run it. | 41 | +`duo_api.conf` in the same directory as the script using the provided example |
42 | +`duo_api.conf.dist` and configure it for your environment and run it. To use | ||
43 | +it without config file, comment out the settings and code provided for that, | ||
44 | +set the configuration values for your environment and run it. | ||
45 | 45 | ||
46 | 46 | ||
47 | <a name=duo_library>duo_library.py</a> | 47 | <a name=duo_library>duo_library.py</a> |
duo_api.tmpl renamed to duo_api.conf.dist
1 | # | 1 | # |
2 | -# duo_api.tmpl - config template for duo_api.py, a pure python3 DUO API client | 2 | +# duo_api.conf.dist - example config for duo_api.py, a pure python3 DUO client |
3 | # | 3 | # |
4 | # Version 1.0, latest version, documentation and bugtracker available at: | 4 | # Version 1.0, latest version, documentation and bugtracker available at: |
5 | # https://gitlab.lindenaar.net/scripts/duo | 5 | # https://gitlab.lindenaar.net/scripts/duo |
duo_api.py
@@ -33,9 +33,9 @@ | @@ -33,9 +33,9 @@ | ||
33 | method to get you started. | 33 | method to get you started. |
34 | 34 | ||
35 | To run the config-file implementation of the client, simply create a config | 35 | To run the config-file implementation of the client, simply create a config |
36 | - file (duo_api.conf) from the template (duo_api.tmpl) and configure it for | ||
37 | - your environment in the same directory as this script and run it. To use it | ||
38 | - without config file, comment out the code below and provide your values. | 36 | + file (duo_api.conf) from the example (duo_api.conf.dist) and configure it |
37 | + for your environment in the same directory as this script and run it. To use | ||
38 | + it without config file, comment out the code below and provide your values. | ||
39 | 39 | ||
40 | See https://duo.com/docs/authapi and https://duo.com/docs/adminapi for the | 40 | See https://duo.com/docs/authapi and https://duo.com/docs/adminapi for the |
41 | available endpoints, parameters and responses. | 41 | available endpoints, parameters and responses. |
@@ -96,7 +96,7 @@ def duo_api_config(config, req, vars=None): | @@ -96,7 +96,7 @@ def duo_api_config(config, req, vars=None): | ||
96 | Returns: the API response (JSON Object) | 96 | Returns: the API response (JSON Object) |
97 | 97 | ||
98 | To pass parameters with the request, provide a dict (section) with a key | 98 | To pass parameters with the request, provide a dict (section) with a key |
99 | - equal to req. Below sample ConfigParser config file for an auth request: | 99 | + equal to req. Below a ConfigParser config file for an auth request: |
100 | 100 | ||
101 | [API] | 101 | [API] |
102 | host=api-XXXXXXXX.duosecurity.com | 102 | host=api-XXXXXXXX.duosecurity.com |
@@ -154,7 +154,7 @@ if __name__ == '__main__': | @@ -154,7 +154,7 @@ if __name__ == '__main__': | ||
154 | # print('Access', response['result']) | 154 | # print('Access', response['result']) |
155 | 155 | ||
156 | # Same example as above, now using a config file, for this to work copy | 156 | # Same example as above, now using a config file, for this to work copy |
157 | - # the file duo_api.tmpl to duo_api.conf and update for your environment | 157 | + # duo_api.conf.dist to duo_api.conf and update for your environment |
158 | config = ConfigParser() | 158 | config = ConfigParser() |
159 | if not config.read(splitext(argv[0])[0] + '.conf'): | 159 | if not config.read(splitext(argv[0])[0] + '.conf'): |
160 | print("Missing/unreadable config file",splitext(argv[0])[0]+'.conf') | 160 | print("Missing/unreadable config file",splitext(argv[0])[0]+'.conf') |