forked from switchdoclabs/SDL_Pi_DataLogger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweepyCode.py
More file actions
25 lines (21 loc) · 673 Bytes
/
TweepyCode.py
File metadata and controls
25 lines (21 loc) · 673 Bytes
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
import tweepy
#sys.path
#sys.path.append('/home/pi/.local/lib/python2.7/site-packages')
def get_api(cfg):
auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret'])
auth.set_access_token(cfg['access_token'], cfg['access_token_secret'])
return tweepy.API(auth)
def main():
# Fill in the values noted in previous step here
cfg = {
"consumer_key" : "x",
"consumer_secret" : "x",
"access_token" : "x",
"access_token_secret" : "x"
}
api = get_api(cfg)
tweet = "Hello, world!"
status = api.update_status(status=tweet)
# Yes, tweet is called 'status' rather confusing
if __name__ == "__main__":
main()