[Python] Post to Twitter script
Posted: February 23rd, 2015, 9:03 am
I made a small and easy python script to update Twitter.
All you need is python and Tweepy libary, and create a twitter "app"
Remember to set the permissions to read/write in the twitter app.
Install tweepy (linux).
Past this code to a ".py" file and save it in your post-process folder.
This will update Twitter with: "Sabnzbd: Download Finished:" + jobname of the download.
Edit the last line if you would like to post something els
How to import the library in Windows i sadly do not know:/
All you need is python and Tweepy libary, and create a twitter "app"
Remember to set the permissions to read/write in the twitter app.
Install tweepy (linux).
Code: Select all
pip install tweepy
Code: Select all
import tweepy
import sys
# Update Twitter with Sabnzbd downloads
try:
(scriptname,directory,orgnzbname,jobname,reportnumber,category,group,postprocstatus,url) = sys.argv
except:
try:
#getting clean jobname from sabnznd
jobname = sys.argv[3]
except:
print "No commandline parameters found"
sys.exit(1)
CONSUMER_KEY = 'past consumer key'
CONSUMER_SECRET = 'past consumer secret'
ACCESS_TOKEN_KEY= 'past access token'
ACCESS_TOKEN_SECRET= 'past access token secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.secure = True
auth.set_access_token(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
api.update_status(status="Sabnzbd: Download Finished: "+jobname)
Edit the last line if you would like to post something els
How to import the library in Windows i sadly do not know:/