Trying out Selenium to make a bot that posts a random quotation to Twitter if my internet speed is too slow.
Table of Contents
Woke up yesterday feeling like hmmm I just HAVE to try Selenium, so here's something I made with it.
Here's what it does:
- Check your if your internet speed is good enough
- If it's too slow, it gets a random quotation from zenquotes
- It logs into the twitter account you saved in the .env file
- It Tweets the quotation and the quotee's name.
Note: The bot was supposed to Tweet a complaint but I replaced it with random quotations because I like them better.
To get a local copy up and running follow these simple example steps.
Click on the links to download and install prerequisites, and copy the code snippets into a terminal to check if installed.
Follow these steps now:
- Create your Twitter account at https://twitter.com/
- Clone the repo
git clone https://github.com/eshabaweja/twote
- Create a .env file inside the repo
touch .env
- Save the following in
.env
TWITTER_USERNAME = 'your_twitter_username' TWITTER_PASSWORD = 'your_twitter_password'
- (Optionally) change the speeds to your need in
main.py
:
PROMISED_UP = your_up_speed
PROMISED_DOWN = your_down_speed
I created this project as a learning experience for myself. The twitter API is obviously an easier alternative to post tweets. However, you may modify this project to scrape the data of your choice and tweet accordingly.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Esha Baweja - @eshcapist