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

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 response to “Retweeting Positive Tweets, Or Part 3 Of Analysing Tweet Sentiment with Azure (Python / Raspberry Pi)”

  1. AWS AWSomeDay June 2019 – Geek Tech Stuff Avatar

    […] has been via Microsoft Azure, which has allowed me to have fun completing various projects (bots, cognitive vision, temperature sensors etc), so I thought it was about time I took a proper look at […]

    Like

Welcome to GeekTechStuff

my home away from home and where I will be sharing my adventures in the world of technology and all things geek.

The technology subjects have varied over the years from Python code to handle ciphers and Pig Latin, to IoT sensors in Azure and Python handling Bluetooth, to Ansible and Terraform and material around DevOps.

Let’s connect