File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "authToken" : " xxx" ,
33 "secretKey" : " xxx" ,
4+ "twitter" : {
5+ "api" : {
6+ "key" : " xxx" ,
7+ "secret" : " xxx"
8+ },
9+ "access" : {
10+ "token" : " xxx" ,
11+ "token-secret" : " xxx"
12+ }
13+ },
414 "tweetsFetchSettings" : {
515 "default" : " live" ,
616 "list" : {
Original file line number Diff line number Diff line change 1111 config = json .load (f )
1212
1313tweetsFetchSettings = config ['tweetsFetchSettings' ]['list' ][config ['tweetsFetchSettings' ]['default' ]]
14+
1415authToken = config ['authToken' ]
1516secretKey = config ['secretKey' ]
17+ twitterAuth = config ['twitter' ]
Original file line number Diff line number Diff line change 11from tweepy import AppAuthHandler , OAuthHandler , API
2- from .shared import base_folder
2+ from .shared import base_folder , twitterAuth
33import json
44import os
55
6- def read_auth_json ():
7- ad = None
8- with open (os .path .join (base_folder , 'twitter-auth.json' )) as json_file :
9- ad = json .load (json_file )
10- if ad is None :
11- raise Exception ('Auth missing' )
12- return ad
136
147def get_auth_app ():
15- ad = read_auth_json () ['api' ]
8+ ad = twitterAuth ['api' ]
169 return AppAuthHandler (ad ['key' ], ad ['secret' ])
1710
1811def get_api_app ():
1912 return API (get_auth_app ())
2013
2114def get_auth_user ():
22- ad = read_auth_json ()
15+ ad = twitterAuth
2316 auth = OAuthHandler (ad ['api' ]['key' ], ad ['api' ]['secret' ])
2417 auth .set_access_token (ad ['access' ]['token' ], ad ['access' ]['token-secret' ])
2518 return auth
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments