Skip to content
Snippets Groups Projects
Commit f4ff308a authored by Benedikt von St. Vieth's avatar Benedikt von St. Vieth
Browse files

remove logging output, error catching when access to b2share is unauthorized.

parent 37f1ec1b
Branches
No related tags found
No related merge requests found
...@@ -79,6 +79,14 @@ class Depositor: ...@@ -79,6 +79,14 @@ class Depositor:
r = requests.post(self.b2shareurl + "records/", r = requests.post(self.b2shareurl + "records/",
params=self.url_params, data=json.dumps(metadata), params=self.url_params, data=json.dumps(metadata),
headers=headers, verify=self.insecure_ssl) headers=headers, verify=self.insecure_ssl)
if r.status_code == 401:
logging.error('Access to {} unauthorized, wrong token?'.format(
self.b2shareurl))
exit(1)
elif r.status_code >= 400:
logging.error('Error while communicating with {}, status code: {}'
.format(self.b2shareurl, r.status_code))
exit(1)
deposit_id = r.json()['id'] deposit_id = r.json()['id']
upload_url = r.json()['links']['files'] upload_url = r.json()['links']['files']
return deposit_id, upload_url return deposit_id, upload_url
...@@ -145,7 +153,6 @@ class Depositor: ...@@ -145,7 +153,6 @@ class Depositor:
headers = {'Content-Type': 'application/octet-stream'} headers = {'Content-Type': 'application/octet-stream'}
for filename in filenames: for filename in filenames:
if '::' in filename: if '::' in filename:
logging.info(filename.count('::'))
if not filename.count('::') is 1: if not filename.count('::') is 1:
logging.error('Too many "::" for filename renaming of {} ' logging.error('Too many "::" for filename renaming of {} '
'given, skipping.'.format(filename)) 'given, skipping.'.format(filename))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment