Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Commit

Permalink
Make stash messages friendlier: resolves #22
Browse files Browse the repository at this point in the history
  • Loading branch information
hughrun committed Mar 3, 2019
1 parent 67a4d4d commit 331a997
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pocket_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ def stash(consumer_key, pocket_access_token, archive_tag, replace_all_tags, reta
print('Processing tags on ' + str(i*20) + ' to ' + str((i*20)+len(tag_chunks[i])) + ' of ' + str(len(items_to_stash)) + '...', end="", flush=True) # printing like this means the return callback is appended to the line
# post update to tags
update_tags = send(actions_escaped, consumer_key, pocket_access_token)
print(update_tags)
if update_tags.raise_for_status() == None:
print('Ok')
else:
print("Oh dear, something went wrong.")
print(update_tags)
time.sleep(2) # don't fire off requests too quickly

# Now archive everything
Expand All @@ -413,7 +417,11 @@ def stash(consumer_key, pocket_access_token, archive_tag, replace_all_tags, reta
# archive items
print('Archiving ' + str(i*20) + ' to ' + str((i*20)+len(chunks[i])) + ' of ' + str(len(items_to_stash)) + '...', end="", flush=True) # printing like this means the return callback is appended to the line
send_callback = send(archive_escaped, consumer_key, pocket_access_token)
print(send_callback)
if send_callback.raise_for_status() == None:
print('Ok')
else:
print("Oh dear, something went wrong.")
print(send_callback)
time.sleep(2) # don't fire off requests too quickly

# return a list of what was stashed and, if relevant, what wasn't
Expand Down

0 comments on commit 331a997

Please sign in to comment.