Skip to content

Instantly share code, notes, and snippets.

@decause
Created June 17, 2013 15:14
Show Gist options
  • Save decause/5797672 to your computer and use it in GitHub Desktop.
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.
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)
@decause
Copy link
Author

decause commented Jun 17, 2013

Here's what the exmaple config.cfg file looks like:

[general]
CLIENT_ID='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
CLIENT_SECRET='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment