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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
How to install dput-ng's twitter bits:
======================================
Before we begin, you should be sure to install the twitter dput-ng
plugin. Here's the quick version for 1.4+ (versions before this didn't include
the script in examples, please fetch the files from git if you're unable to
use a recent dput-ng version).
If it's not, remember to even install the python3-tweepy package.
It's mandatory to have this hook working correctly.
mkdir -p ~/.dput.d/{scripts,hooks}
ln -s /usr/share/doc/dput-ng/examples/hooks/twitter/code/tweet.py \
~/.dput.d/scripts/tweet.py
ln -s /usr/share/doc/dput-ng/examples/hooks/twitter/skel/tweet.json \
~/.dput.d/hooks/tweet.json
So, right now, setting this plugin up is a *bit* of a pain for two reasons.
1) Twitter refuses to allow apps to ship secret key / id, which means that
Twitter expects you (yes you, the end user) to register for an Application.
They insist (otherwise) on a "best-effort" to hide the keys, so in the
future, I may include something like:
key = "FCi6UeIMwXxAIiZVkd19t".decode('rot-13')
secret = "4m8LFfivMlVeqCzQNLIhj2EgqjkAAg3e49KbUIeZ".decode('rot-13')
2) We don't have a script to get a user token (etc), so even if we did ship
a script to generate the oath_secret / oath_token. Contributions to this
are uber welcome.
HowTo:
======
We need to register for a twitter app. Go to:
https://dev.twitter.com/apps/new
name: paultag-dput-ng # replace paultag with your name
description: dput: The Next Generation
website: http://dput-ng.debian.net
[x] Yes, I agree!
> nonsense CAPtCHA1
[Create your Twitter Application]
Now that the app is created, you should be on the /apps/show screen.
Go to the [Settings] tab, and go to the "Application Type" pane. Change
"Read-only" to "Read and Write", then click on:
[Update this Twitter application's settings]
Go back to the [Details] tab, go to the bottom and click on:
[Create my Access Token]
You should now see "Your access token"
It'll have the following in the table:
Access token: [token]
Access token secret: [secret]
Access level: Read and write
OK, now that we have all the information:
Now, let's drop down the config:
cat <<EOF > ~/.twitter.json
{
"consumer_key": "",
"consumer_secret": "",
"oath_secret": "",
"oath_token": ""
}
EOF
Now:
$ sensible-editor ~/.twitter.json
Edit and add your information.
Consumer Key / Secret --> consumer_key/secret
Access token --> oauth_token
Access secret --> oauth_secret
Finally, we add the hook to targets we want:
$ if [ ! -d ~/.dput.d/profiles/ ]; then mkdir -p ~/.dput.d/profiles/; fi
$ cat <<EOF > ~/.dput.d/profiles/ftp-master.json
{
"+hooks": [
"tweet"
]
}
EOF
And there we are! Sorry it's so painful! Fixes to come, I'm sure!
|