Page 1 of 1

Twitter uploads

Posted: Fri 26 Nov 2021 7:21 pm
by raul_sbd
Hi everyone,

Sorry if this is been asked before but does anyone knows how to set up Twitter uploads? I know there is an option in Cumulus web options to enter Twitter credentials but do you need anything else apart of a Twitter dedicated account?
Can you provide step by step instructions if there is the option for the uploads please?

Many Thanks!!

Re: Twitter uploads

Posted: Fri 26 Nov 2021 7:42 pm
by PaulMy
The Twitter updates from Cumulus stopped working several years ago due to some Twitter issue. However Twitter can be updated by Weathercloud, and Weathercloud is one of the third-party weather services that can be updated by Cumulus.
https://twitter.com/KomokaWeather
https://app.weathercloud.net/d0280022074#current

Enjoy,
Paul

Re: Twitter uploads

Posted: Fri 26 Nov 2021 9:43 pm
by raul_sbd
PaulMy wrote: Fri 26 Nov 2021 7:42 pm The Twitter updates from Cumulus stopped working several years ago due to some Twitter issue. However Twitter can be updated by Weathercloud, and Weathercloud is one of the third-party weather services that can be updated by Cumulus.
https://twitter.com/KomokaWeather
https://app.weathercloud.net/d0280022074#current

Enjoy,
Paul
Thank you Paul I have created the Weathercloud account now and linked my weather station in Cumulus Mx.. after that how do I do it to link to the Twitter account?

Re: Twitter uploads

Posted: Fri 26 Nov 2021 10:55 pm
by PaulMy
after that how do I do it to link to the Twitter account?
I expected this question :bash: but can't remember what I had to do as it has been a few years :oops:
I am sure there is a setting somewhere... I'll look again.

Enjoy,
Paul

Re: Twitter uploads

Posted: Fri 26 Nov 2021 11:16 pm
by raul_sbd
My bad Paul!! I have done it now ;)

There it is ;

https://app.weathercloud.net/d6743448014

Many thanks for your help ;)

Re: Twitter uploads

Posted: Fri 26 Nov 2021 11:42 pm
by PaulMy
Hi,
Glad you got it added.
Took a while but found the place to add Twitter and have attached in case someone else wants to give it a try.

Enjoy,
Paul

Re: Twitter uploads

Posted: Sat 27 Nov 2021 5:58 pm
by BigOkie
If you want to use a direct solution and not have to rely on WeatherCloud as a proxy, I use a Python script and cron (I use a RPI 3). It takes some configuration though. It's been so long since I configured it I might take a while to get it all together if anyone is interested.

EDIT: I think regardless if anyone says yes or no I will go ahead and provide details on how I did this.

Pre-requisites - *must* have Python 3 installed, and must install Twython (the Twitter wrapper for Python 3) The assumption here is that you are doing this using some form of Linux, whether it be a full-fledged version, or the Raspian OS. You must also generate consumer keys and access keys assigned to the app (in my instance I just have a generic). To do this visit https://dev.twitter.com

Once you have Python 3 and Twython imported (I believe you still do this by issuing the 'pip modulename' command), you create a python script to do what you need. I have mine and will provide it (with tokens masked of course but you'll get the idea).

Code: Select all

#!/usr/bin/env python

from twython import Twython
# delay 5 seconds
import time
time.sleep(5)
# Define constants
CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxx'
ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxx'
ACCESS_SECRET ='xxxxxxxxxxxxxxxxxxxx'


# Create a copy of the Twython object with all our keys and secrets to allow easy commands.
api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)

text = open('/path/to/generated/tweet.txt','rb') # Cumulus has been set to create tweet.txt by processing tweetT.txt
api.update_status(status=text)

# api.update_status is now deprecated, but works, and is simpler than the below [untested]
#twitter.update_status(status=text)
You will need to create a template file that you generate using the web interval with the tags you want to include in the tweet. As an example, here's what I use (template filename is tweetT.txt) but you can include or exclude whatever you want:

Code: Select all

Temp: <#temp>°F DP: <#dew>°F  HtIdx: <#heatindex>°F High today: <#tempTH>°F @ <#TtempTH> Low today: <#tempTL>°F @ <#TtempTL> Wind: <#wdir> @ <#wspeed> mph Baro: <#press> inHg and <#presstrend> Rain Today <#rfall>in Rain for <#shortmonthname>: <#rmonth>in #okwx
Generate the file, and name it whatever you want, but make sure the file reference in the python script above is the path and filename to the file generated.

Once you've done this, I would suggest you test it first before you set to a schedule in a cron job.

Assuming you've named the python script 'twitter.py', issue the following command:

Code: Select all

python3 twitter.py
Be patient, it may take a few seconds to complete. There is no progress indicator, but as long as you don't see any error it should work. Once completed, this was what I saw after my test:
2021-11-27_121858.png
If there are any question, please reply here and I will answer them to the best of my ability.

Re: Twitter uploads

Posted: Sat 27 Nov 2021 10:00 pm
by dazza1223
is there one for Facebook page ? or can it be done in this way?

Re: Twitter uploads

Posted: Tue 14 Jun 2022 3:55 pm
by Pondlife
Apologies for thread bumping.

How do you create the twitter.txt output file please?

I guess it's somewhere under internet settings but can't find the right place.

TIA.

Re: Twitter uploads

Posted: Tue 14 Jun 2022 9:12 pm
by BigOkie
Pondlife wrote: Tue 14 Jun 2022 3:55 pm Apologies for thread bumping.

How do you create the twitter.txt output file please?

I guess it's somewhere under internet settings but can't find the right place.

TIA.
Extra web files. Not internet settings.

This is what I use, but you'll need to suit it for your needs. You shouldn't need to do anything but process the file. The python script should do all the work. Those pathnames obviously can be whatever you want to use. Also, if you're using Windows 7, I can't help much there as my example as stated is using Raspberry Pi (some form of Linux).
2022-06-14_161059.png

Re: Twitter uploads

Posted: Tue 21 Jun 2022 9:29 am
by Pondlife
Sorted thanks