I had started to tweet from my weather station and wanted to format my tweets and use conditional statements. Using the uploader on the wiki, I could not figure out how I could do any of these.
I had already set up the app credentials and twython was installed. A little reading through twython docs gave me an idea. I wrote a simple text template to give the data I wanted (including conditional statements to tailor my tweets to the conditions) and then wrote a script to use twython to post my text file. Add a cronjob and voila, I get a tweet every hour on the hour with the exact formatting that I wanted using the familiar dot code system. The big plus is that I realised that I can also send a "Good morning" tweet with an image from my webcam. RESULT Thank you to all that contribute to this user group for the inspiration to continue learning. Regards Robin I've attached my script if anyone is interested. This is what my tweet now looks like: <https://lh3.googleusercontent.com/-l7TDCLR2qfI/V-PRBCXw4rI/AAAAAAAABmk/37GLKaLewlki09OyYKw5oYZLA29Jq1uggCLcB/s1600/screen-grab.jpg> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/python from twython import Twython app_key = 'Consumer key' app_secret = 'Consumer secret' oauth_token = 'Access token' oauth_token_secret = 'Access token secret' twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret) file = open('/var/www/weewx/tweet.txt', 'r') msg = file.read() twitter.update_status(status=msg)