#100DaysOfWeb in Python Transcripts
Chapter: Days 77-80: Twitter and Slack bots
Lecture: Project: automate #100DaysOfCode tweeting

Login or purchase this course to watch this video and the rest of the course contents.
0:01 All right, starting with Twitter API these days you have to apply for a developer account so I would recommend if you want to follow along
0:11 with Twitter to pause the video and do that right now. So you head over to Apps.Twitter.com you should see the same message
0:20 and you can apply for a developer account. You probably want it for personal use.
0:41 And here it's important that you give a solid reason why you want that access so I did it for my other account two days ago.
0:51 I basically said I'm building apps on Twitter and to automate some of my tasks. I want to auto-tweet the thing we're going to do in this lesson
1:00 and a bunch of other reasons. For example at PyBites we have an other bot that auto-tweets the free Packt title everyday.
1:08 We have an auto-tool to make our Twitter digest et cetera. So I listed them all up and they approved it. So again, you're not required to do it
1:18 you can still follow along with this lesson not applying and just looking at my code and learn about other libraries
1:24 like logging and config, parser and Requests but I would recommend to do it. Twitter's pretty significant, also among developers
1:32 and I think it's nice to automate your 100DaysOfCode tweets. I mean, it's a hundred times you have to go online. We automated when we did 100DaysOfCode
1:43 and it did put some pressure on us but it was definitely a nice tool. Having said that, of course, it's already pretty advanced
1:51 in the hundred days but a lot of people repeat their 100 Days so it can still be useful if you choose to do another round of 100 Days.
1:59 And here's our 100DaysOfCode grid on our PyBites code challenge platform. You should be familiar with this grid as at the start of the course
2:08 we introduced you to how to set it up to follow along with this course. But you can use it for any project. We are going to crawl this URL
2:18 and match the date so if today was 23rd of September I would get day eight and a corresponding activity tweet.
2:27 It's going to grab that content and post it to Twitter given that you have a private key as loaded in from an environment variable.
2:37 Important to note, on their settings you need to turn on public URL sharing otherwise this URL's private and the script cannot access it.
2:49 And this is how we interface with the script. We can call it minus U, user, and minus P, grid ID or project ID, so you can even use it for other grids
3:00 but most sense makes to, just for your own stuff. There is logging going on and below you see how to look on your timeline.
3:08 The same as you probably are tweeting right now but this is fully automated. Standard library modules we're going to use are parse
3:15 configparser, datetime, logging, a lot of good stuff you will often use in your Python day-to-day. And external libraries you will need are Tweepy
3:27 to interface with Twitter, Requests to load in the created URL and Beautiful Soup to parse the grid, the HTML, to get out specific elements.
3:40 There's quite some code to write so let's do that in the next video.


Talk Python's Mastodon Michael Kennedy's Mastodon