Customizable driver
This commit is contained in:
parent
7ae7ebc6a6
commit
a43f93be58
2 changed files with 4 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
"datadir": "data/",
|
"datadir": "data/",
|
||||||
|
"browserdriver": "phantomjs",
|
||||||
"credfile": "cred.txt"
|
"credfile": "cred.txt"
|
||||||
}
|
}
|
||||||
|
|
6
leggi.py
6
leggi.py
|
@ -15,8 +15,8 @@ def read_pass_file(fname):
|
||||||
return user, pwd
|
return user, pwd
|
||||||
|
|
||||||
|
|
||||||
def get_calls(user, password):
|
def get_calls(user, password, driver='firefox'):
|
||||||
with Browser('phantomjs') as b:
|
with Browser(driver) as b:
|
||||||
b.visit('https://www.messagenet.com/')
|
b.visit('https://www.messagenet.com/')
|
||||||
b.fill('userid', user)
|
b.fill('userid', user)
|
||||||
b.fill('password', password)
|
b.fill('password', password)
|
||||||
|
@ -43,5 +43,5 @@ if __name__ == '__main__':
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
conf.update(json.load(open(sys.argv[1])))
|
conf.update(json.load(open(sys.argv[1])))
|
||||||
user, password = read_pass_file(conf['credfile'])
|
user, password = read_pass_file(conf['credfile'])
|
||||||
calls = tuple(get_calls(user, password))
|
calls = tuple(get_calls(user, password, conf['browserdriver']))
|
||||||
save_calls(calls, conf['datadir'])
|
save_calls(calls, conf['datadir'])
|
||||||
|
|
Loading…
Reference in a new issue