-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtweet_BBS_logout.py
32 lines (25 loc) · 951 Bytes
/
tweet_BBS_logout.py
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
#!/usr/bin/env python
# tweet.py by Alex Eames http://raspi.tv/?p=5908
# Modified to tweet BBS connections
import tweepy, sys, datetime
# Consumer keys and access tokens, used for OAuth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
access_token = 'access_token'
access_token_secret = 'access_token_secret'
# OAuth process, using the keys and tokens
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
# Creation of the actual interface, using authentication
api = tweepy.API(auth)
time = datetime.datetime.now()
timenow = '{:%H:%M:%S}'.format(time)
# Enter tweet text below
if len(sys.argv) >= 2:
tweet_text = sys.argv[1] + " [Enter some text here] @ " + str(timenow)
else:
tweet_text = "Still messing about with tweepy and twitter API. :)"
if len(tweet_text) <= 280:
api.update_status(status=tweet_text)
else:
tweet_text = "UserName too long!"