Skip to content

Commit 8b26ee5

Browse files
committed
save userid after login and use it in other commands
1 parent 6702f9a commit 8b26ee5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

inoreader/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ def get_client():
5858
print("Please login first")
5959
sys.exit(1)
6060

61-
client = InoreaderClient(appid, appkey, token)
61+
userid = None
62+
if config.has_section('user'):
63+
userid = config.get('user', 'id')
64+
65+
client = InoreaderClient(appid, appkey, userid=userid, auth_token=token)
6266
return client
6367

6468

@@ -95,6 +99,10 @@ def login():
9599
config['auth']['token'] = auth_token
96100
else:
97101
config['auth'] = {'token': auth_token}
102+
103+
appid, appkey = get_appid_key(config)
104+
client = InoreaderClient(appid, appkey, auth_token=auth_token)
105+
config['user'] = {'email': username, 'id': client.userinfo()['userId']}
98106
with codecs.open(CONFIG_FILE, mode='w', encoding='utf-8') as fconfig:
99107
config.write(fconfig)
100108
print("save token in {}, ".format(username, CONFIG_FILE))

0 commit comments

Comments
 (0)