-
Notifications
You must be signed in to change notification settings - Fork 0
/
twimy.py
executable file
·41 lines (30 loc) · 969 Bytes
/
twimy.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
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy
import sys
from ConfigParser import ConfigParser
def auth():
conf = {}
config = ConfigParser()
config.read('conf.cfg')
conf ['consumer_token'] = config.get('consumer', 'consumer_token')
conf ['consumer_secret'] = config.get('consumer', 'consumer_secret')
conf ['authKey'] = config.get('auth', 'authKey')
conf ['authSecret'] = config.get('auth', 'authSecret')
consumer_token = conf['consumer_token']
consumer_secret = conf['consumer_secret']
authKey = conf['authKey']
authSecret = conf['authSecret']
auth = tweepy.OAuthHandler(consumer_token, consumer_secret)
auth.set_access_token(authKey, authSecret)
api = tweepy.API(auth)
return api
def Tweet(twit):
if len(twit) in range(1, 141):
api.update_status(twit)
return True
else:
return False
if __name__ == "__main__":
api = auth()
Tweet(sys.argv[1])