#100DaysOfWeb in Python Transcripts
Chapter: Days 77-80: Twitter and Slack bots
Lecture: Manage config data with configparser

Login or purchase this course to watch this video and the rest of the course contents.
0:01 First we're going to load in the Twitter config information from our config.ini file and let's write that file actually first.
0:21 And it's going to look like this section and consumer key which I abbreviated to cs key consumer secret, access token
0:42 again I abbreviate it to acc token and access secret. And here you put in the keys you got from Twitter. So again, consumer key, consumer secret
0:58 access token and access secret. When you make a app on Twitter those are four tokens you should get. Let me put that in a config.ini file.
1:09 Best practice is to hide this file immediately from your version control so I'm going to make a .gitignore and I'm going to put my config.ini in here.
1:21 Also put my venv in here. Those are files that I don't want to commit to version control. I'm just making sure I have a git ignore right away
1:30 so I'm not accidentally putting my config.ini file under version control. What I do want to put in version control
1:42 is a copy. And in this case, it's fine because I put fake tokens in here. So you want to have two files config.ini and config.in.example.
2:03 In any, you want to have your real stuff which is hidden from version control and the example you want to include in version control which is bogus
2:13 but that's useful for somebody that's using your repo or script so they can then copy the config.ini.example
2:21 into config.ini and just fill in the blanks. Alright, back to the script. Now I'm ready to load in the config.ini file.
2:39 And let's see if that worked. Got an error.
3:00 I have a checker up on saving in my vimrc to check syntax and URL was not defined so I decided to none to get around that.
3:13 Okay, I get a config parser object. That's good. Let's see what's in there. It should have a Twitter section.
3:33 It does but it's not really printing it to pp that's fine. I will just do a quick test myself. Perfect. So now I'm going to store all these
3:51 secret keys and tokens into constants. So starting with consumer key. Perfect.

Talk Python's Mastodon Michael Kennedy's Mastodon