only store password if login worked
This commit is contained in:
parent
0d86b144f5
commit
23cd8ac541
1 changed files with 4 additions and 1 deletions
5
edit.py
5
edit.py
|
@ -142,6 +142,7 @@ if __name__ == '__main__':
|
|||
'password': data['password']
|
||||
}
|
||||
|
||||
update = False
|
||||
if not credentials:
|
||||
try:
|
||||
credentials = ox.web.auth.get(site)
|
||||
|
@ -150,7 +151,7 @@ if __name__ == '__main__':
|
|||
print('Please provide your username and password for %s:' % site)
|
||||
credentials['username'] = input('Username: ')
|
||||
credentials['password'] = getpass.getpass('Password: ')
|
||||
ox.web.auth.update(site, credentials)
|
||||
update = True
|
||||
|
||||
api = API(base_url + '/api/')
|
||||
r = api.signin(**credentials)
|
||||
|
@ -158,6 +159,8 @@ if __name__ == '__main__':
|
|||
for kv in r['data']['errors'].items():
|
||||
print('%s: %s' % kv)
|
||||
sys.exit(1)
|
||||
if update:
|
||||
ox.web.auth.update(site, credentials)
|
||||
print('Edit:', edit_id)
|
||||
print('Sort:', sort_by)
|
||||
r = api.getEdit(id=edit_id)
|
||||
|
|
Loading…
Reference in a new issue