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. I have attached a 'grab' so
you can see the result.
The big plus is that I realised that I can also tweet "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 also attached my script if anyone is interested.
--
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 [email protected].
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)