1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# Copyright (c) Paul Tagliamonte, 2012, under the terms of dput-ng.
# Example: https://twitter.com/paultag/status/257981606139133954
import tweepy
import json
import os
def tweet(changes, profile, interface):
tweet = "I've just uploaded %s/%s to %s's %s suite #debian" % (
changes['Source'],
changes['Version'],
profile['name'],
changes['Distribution']
)
if len(tweet) > 280:
tweet = tweet[:280]
with open(os.path.expanduser("~/.twitter.json"), 'r') as f:
obj = json.load(f)
t = tweepy.Client(
consumer_key=obj['consumer_key'],
consumer_secret=obj['consumer_secret'],
access_token=obj['oath_token'],
access_token_secret=obj['oath_secret']
)
t.create_tweet(text=tweet)
|