Retweeting Positive Tweets, Or Part 3 Of Analysing Tweet Sentiment with Azure (Python / Raspberry Pi)

Twitter, Azure and Python to automatically retweet positive Tweets

With the Python program (see part 1 and part 2) collecting Tweets from Twitter and then analysing the data via Azure to see if the sentiment is positive, neutral or negative it only means I am one step away from being able to retweet positive tweets. I’ve reused some of the code from my earlier Twitter Tweet bot (which currently automatically tweets the temperature of a room) and at regular intervals the Twitter Bot automatically retweets tweets that contain “geektechstuff” and are (according to Azure) positive in sentiment.

geektechstuff_tweet_auto_retweet_azure
Twitter, Azure and Python to automatically retweet positive Tweets

The full code can be found on my GitHub, I’ve but comments into the code and my Twitter bot can be seen in action at https://twitter.com/geektechstuff_a

I’m running the code automatically at regular intervals on my Raspberry Pi using a Cron job. One note; I hit an issue originally on my Pi as I had not updated the Python Twython module and I had to adjust the text file to the complete file path and name (rather than just the name) as otherwise Cron had issues running the Python code. If Cron is not auto running the Python program for you then I recommend opening the Pi’s Terminal and using the command:

grep CRON /var/log/syslog

I wrote an entry on grep a little while ago, and also one on cron . The file path /var/log/syslog is the path of the log files containing cron errors.

 

One thought on “Retweeting Positive Tweets, Or Part 3 Of Analysing Tweet Sentiment with Azure (Python / Raspberry Pi)

Comments are closed.