-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathParseTwitterConfig.py
More file actions
67 lines (50 loc) · 2 KB
/
ParseTwitterConfig.py
File metadata and controls
67 lines (50 loc) · 2 KB
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
import ConfigParser
import io
class Parser:
_consumerKey = ""
_consumerSecret = ""
_accessToken = ""
_accessTokenSecret = ""
_owner = ""
_ownerId = ""
_configFilePath = ""
_maxTweets="100"
configParser = ConfigParser.RawConfigParser()
def __init__(self, filepath):
self._configFilePath = filepath
print 'Using File : ', filepath
try:
self.configParser.readfp(open(filepath, 'r'))
except:
print 'Invalid cofig file path, Cannot open', filepath
def parseConfig(self):
try:
self._consumerKey = self.configParser.get('User_Twitter_Config','ConsumerKey')
self._consumerSecret = self.configParser.get('User_Twitter_Config','ConsumerSecret')
self._accessToken = self.configParser.get('User_Twitter_Config','AccessToken')
self._accessTokenSecret = self.configParser.get('User_Twitter_Config','AccessTokenSecret')
self._owner = self.configParser.get('User_Twitter_Config','Owner')
self._ownerId = self.configParser.get('User_Twitter_Config','OwnerId')
self._maxTweets = self.configParser.get('User_Twitter_Config','maxTweets')
self._chromePath = self.configParser.get('User_Twitter_Config','chromePath')
self._chromeDriverPath = self.configParser.get('User_Twitter_Config','chromeDriverPath')
except:
print 'Invalid configuration'
def getConsumerKey(self):
return self._consumerKey
def getConsumerSecret(self):
return self._consumerSecret
def getAccessToken(self):
return self._accessToken
def getAccessTokenSecret(self):
return self._accessTokenSecret
def getOwner(self):
return self._owner
def getOwnerId(self):
return self._ownerId
def getMaxTweets(self):
return self._maxTweets
def getChromePath(self):
return self._chromePath
def getChromeDriverPath(self):
return self._chromeDriverPath