Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sync_status(self, pid, *args, **kwargs):
"""Synchronize DOI status DataCite MDS."""
status = None
try:
self.api.doi_get(pid.pid_value)
status = cfg['PIDSTORE_STATUS_REGISTERED']
except DataCiteGoneError:
status = cfg['PIDSTORE_STATUS_DELETED']
except DataCiteNoContentError:
status = cfg['PIDSTORE_STATUS_REGISTERED']
except DataCiteNotFoundError:
pass
except DataCiteError as e:
pid.log("SYNC", "Failed with %s" % e.__class__.__name__)
return False
except HttpError as e:
pid.log("SYNC", "Failed with HttpError - %s" % unicode(e))
return False
if status is None:
try:
self.api.metadata_get(pid.pid_value)
status = cfg['PIDSTORE_STATUS_RESERVED']