use ox.api.signin
This commit is contained in:
parent
fa3855b4c8
commit
f81fa3a7d6
1 changed files with 2 additions and 18 deletions
|
@ -5,26 +5,10 @@ import json
|
|||
import sys
|
||||
|
||||
import ox
|
||||
import ox.web.auth
|
||||
import ox.api
|
||||
|
||||
site = 'pandora.cinemusespace.com'
|
||||
api = ox.API('https://%s/api/' % site)
|
||||
update = False
|
||||
try:
|
||||
credentials = ox.web.auth.get(site)
|
||||
except:
|
||||
credentials = {}
|
||||
print('Please provide your username and password for %s:' % site)
|
||||
credentials['username'] = input('Username: ')
|
||||
credentials['password'] = getpass.getpass('Password: ')
|
||||
update = True
|
||||
r = api.signin(**credentials)
|
||||
if 'errors' in r.get('data', {}):
|
||||
for kv in r['data']['errors'].items():
|
||||
print('%s: %s' % kv)
|
||||
sys.exit(1)
|
||||
if update:
|
||||
ox.web.auth.update(site, credentials)
|
||||
api = ox.api.signin('https://%s/api/' % site)
|
||||
|
||||
keywords = set()
|
||||
for annotation in api.findAnnotations({
|
||||
|
|
Loading…
Reference in a new issue