Created
June 17, 2013 15:14
-
-
Save decause/5797672 to your computer and use it in GitHub Desktop.
Dead simple example of using ConfigParser to pull values from a config file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ConfigParser | |
config = ConfigParser.ConfigParser() | |
config.read('config.ini') | |
CLIENT_ID = config.get('general', 'CLIENT_ID', 0) | |
CLIENT_SECRET = config.get('general', 'CLIENT_SECRET', 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what the exmaple config.cfg file looks like:
[general]
CLIENT_ID='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
CLIENT_SECRET='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'