clean dropbox errors

1. set autorename feature
2. don't log an error unless there's an error!
bugfix
eric 2019-05-16 21:36:45 -04:00
parent 87732e31b7
commit 3b32e93dae
1 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,8 @@ class Dropbox (CloudStorage.CloudStorage):
""" """
parameters = { parameters = {
'path': '/' + self.fix_filename (session.ebook.get_filename ()) 'path': '/' + self.fix_filename (session.ebook.get_filename ()),
'autorename': True,
} }
headers = { headers = {
'Authorization' : 'Bearer ' + str (session.token), 'Authorization' : 'Bearer ' + str (session.token),
@ -59,5 +60,6 @@ class Dropbox (CloudStorage.CloudStorage):
with closing (session.post (self.upload_endpoint, with closing (session.post (self.upload_endpoint,
data = response.content, data = response.content,
headers = headers)) as r: headers = headers)) as r:
CloudStorage.error_log (r.text) if 'error_summary' in r.text:
CloudStorage.error_log (r.text)
r.raise_for_status () r.raise_for_status ()