-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.py
52 lines (42 loc) · 1.28 KB
/
manager.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
# coding: utf-8
from sitelib import BTSSite, RMSite
from csvlib import BTSCSV, RMCSV
import json
config = json.load(open('config.json', 'r'))
class Manager:
site = None
csv = None
def download(self):
self.site.login()
response = self.site.request()
self.csv.set(response)
def cleanse(self):
self.csv.cleanse()
def save(self):
self.csv.save()
class BTSManager(Manager):
def __init__(self):
user = config['bts']['user']
pwd = config['bts']['pwd']
filename = config['bts']['filename']
self.site = BTSSite(user, pwd)
self.csv = BTSCSV(filename)
class BTSHTMLManager(BTSManager):
def __init__(self):
user = config['bts']['user']
pwd = config['bts']['pwd']
filename = config['bts']['filename']
self.site = BTSHTMLSite(user, pwd)
self.csv = BTSHTMLCSV(filename)
class RMManager(Manager):
def __init__(self):
user = config['rm']['user']
pwd = config['rm']['pwd']
filename = config['rm']['filename']
self.site = RMSite(user, pwd)
self.csv = RMCSV(filename)
if __name__ == '__main__':
for manager in [BTSManager(), RMManager()]:
manager.download()
manager.cleanse()
manager.save()