-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser.py
53 lines (44 loc) · 1.28 KB
/
user.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
41
42
43
44
45
46
47
48
49
50
51
52
53
class User():
def __init__(self):
self._username = ""
self._token = ""
self._client_id = ""
self._client_secret = ""
self.config()
@property
def username(self):
return self._username
@username.setter
def username(self, x):
self._username = x
@property
def token(self):
return self._token
@token.setter
def token(self, x):
self._token = x
@property
def client_id(self):
return self._client_id
@client_id.setter
def client_id(self, x):
self._client_id = x
@property
def client_secret(self):
return self._client_secret
@client_secret.setter
def client_secret(self, x):
self._client_secret = x
def config(self):
with open("config", "r") as f:
for i in f:
lhs = i.split("=")[0].rstrip()
rhs = i.split("=")[1].lstrip().split("\n")[0]
if lhs == "username":
self.username = rhs
elif lhs == "token":
self.token = "Bearer " + rhs
elif lhs == "client_id":
self.client_id = rhs
elif lhs == "client_secret":
self.client_secret = rhs