Closed ykdojo closed 5 years ago
What account should this bot control?
this one: https://twitter.com/editdojo
@ykdojo We can use the Tweepy library along with the Twitter API which we can get through Developer account.
Okay sounds good. I already got a developer account for @editdojo :)
To set up Tweepy we need the consumer key, consumer secret, a access token and a access token secret. Is publicly posting these keys and tokens from the editdojo account a security risk?
Yeah I think it's best to put those files in .gitignore.
Then, each of us can get a Twitter dev account separately and test it with our own Twitter account?
I was thinking the consumer information could be stored into a config.json file, and change the .gitignore to ignore it. This way we each only need to create the json file with the four required info. Or is there a better way to store this information
That sounds like a good method!
On Wed, Oct 24, 2018 at 5:41 PM Kyle McCullen notifications@github.com wrote:
I was thinking the consumer information could be stored into a config.json file, and change the .gitignore to ignore it. This way we each only need to create the json file with the four required info. Or is there a better way to store this information
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ykdojo/editdojo/issues/14#issuecomment-432838165, or mute the thread https://github.com/notifications/unsubscribe-auth/ABukw3ESCWv2QjIiGMDs0HoEd9NGkvxfks5uoN5ogaJpZM4X4ZPs .
I'm thinking of working on this one next. I'm probably going to make a video about this, too.
Find some references for this.
The official Tweepy documentation: https://tweepy.readthedocs.io/en/v3.6.0/index.html A freeCodeCamp article: https://medium.freecodecamp.org/creating-a-twitter-bot-in-python-with-tweepy-ac524157a607
I'll try following them and see if I can understand them first.
The freeCodeCamp article was kind of follow, but I found another article on this topic.
https://dev.to/emcain/how-to-set-up-a-twitter-bot-with-python-and-heroku-1n39
This looks more promising. Will take a look at it tomorrow morning, I think.
I'm thinking of putting the keys in a separate Python file and call it keys.py or something.
So for Twitter API, looks like we have these two choices:
Ugh looks like Tweepy is not compatible with Python 3.7. Maybe I'll use Python 3.6 instead.
Turns out, downgrading Python is a huge pain.
So, I used this command instead to install a more recent version of tweepy:
pipenv install -e git+https://github.com/tweepy/tweepy.git@2efe385fc69385b57733f747ee62e6be12a1338b#egg=tweepy
I found a related command for this here: https://github.com/tweepy/tweepy/issues/1063
I also used this as a reference: https://realpython.com/pipenv-guide/#example-usage
K this is done. I'm planning to publish a video about it tomorrow. https://github.com/ykdojo/twitterbotsample
Just for a reference, here's the video: https://youtu.be/W0wWwglE1Vc
This is just so that we can learn how to use Twitter API.
Maybe something that says "hello, world back to you!" when it receives a Twitter mention that says "hello, world!"