Skip to content
This repository has been archived by the owner on Feb 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #12 from rakanalh/update-pocket-api
Browse files Browse the repository at this point in the history
Fix pocket object initialization for config step
  • Loading branch information
rakanalh committed Sep 30, 2016
2 parents 4a7784e + 8c7f704 commit 32236b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 12 additions & 4 deletions pocket_cli/app.py
Expand Up @@ -43,14 +43,22 @@ def configure(self, consumer_key, access_token,

self._storage.clear()

def get_request_token(self, consumer_key):
self._pocket = Pocket(
consumer_key,
access_token
)

def init_consumer_key(self, consumer_key):
self._pocket = Pocket(consumer_key)

def get_request_token(self):
return self._pocket.get_request_token(
consumer_key, self.REDIRECT_URL
self.REDIRECT_URL
)

def get_access_token(self, consumer_key, request_token):
def get_access_token(self, request_token):
return self._pocket.get_access_token(
consumer_key, request_token
request_token
)

def add_article(self, url, title=None, tags=None):
Expand Down
6 changes: 4 additions & 2 deletions pocket_cli/cli.py
Expand Up @@ -48,7 +48,9 @@ def main():
'\tdefault:',
help='Used in calculating reading time for each article')
def configure(consumer_key, sort_field, words_per_minute):
request_token = pocket_app.get_request_token(consumer_key)
pocket_app.init_consumer_key(consumer_key)

request_token = pocket_app.get_request_token()

if not request_token:
print('Could not obtain request_token')
Expand All @@ -62,7 +64,7 @@ def configure(consumer_key, sort_field, words_per_minute):
webbrowser.open_new_tab(url)
input()

access_token = pocket_app.get_access_token(consumer_key, request_token)
access_token = pocket_app.get_access_token(request_token)

if not access_token:
print('Could not obtain access token')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -2,7 +2,7 @@

setup(
name='pocket-cli',
version='0.1.4',
version='0.1.5',
author='Rakan Alhneiti',
author_email='rakan.alhneiti@gmail.com',
url='https://github.com/rakanalh/pocket-api',
Expand Down

0 comments on commit 32236b3

Please sign in to comment.