Skip to content

Commit

Permalink
raise error on failed upload
Browse files Browse the repository at this point in the history
  • Loading branch information
7aske committed Feb 11, 2019
1 parent b3b8058 commit 5a47ead
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions instapy_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from instapy_cli.api import InstapySession
from instapy_cli.media import Media


class InstapyCli(object):
def __init__(self, username, password):
self._session = InstapySession()
Expand All @@ -27,9 +28,12 @@ def upload(self, file, caption=''):
print('\nSomething went bad.\nPlease retry or send an issue on https://github.com/b3nab/instapy-cli\n')
upload_completed = False
finally:
if upload_completed:
print('Done.')

# media_status = 'YES' if media.isDownloaded() else 'NO'
# print('Media is a downloaded file? ' + media_status)
if media.isDownloaded():
media.removeMedia()
media.removeMedia()
if upload_completed:
print('Done.')
else:
raise IOError("Unable to upload.")

0 comments on commit 5a47ead

Please sign in to comment.