Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if status_code == 202:
self.logger.info("%s accepted for retrieval", product_info["id"])
retrieval_scheduled[product_info["id"]] = product_info
break
elif status_code == 403:
self.logger.info(
"Request for %s exceeded user quota. Retrying in %d seconds",
product_info["id"],
retry_delay,
)
stop_event.wait(timeout=retry_delay)
else:
# Should not happen. As error are processed by _trigger_offline_retrieval
self.logger.error("Unexpected response %s from SciHub", status_code)
raise SentinelAPILTAError("Unexpected response from SciHub")
with self.session.get(url, auth=self.session.auth, timeout=self.timeout) as r:
# check https://scihub.copernicus.eu/userguide/LongTermArchive#HTTP_Status_codes
if r.status_code == 202:
self.logger.debug("Accepted for retrieval")
elif r.status_code == 403:
self.logger.debug("Requests exceed user quota")
elif r.status_code == 503:
self.logger.error("Request not accepted")
raise SentinelAPILTAError("Request for retrieval from LTA not accepted", r)
elif r.status_code == 500:
# should not happen
self.logger.error("Trying to download an offline product")
raise SentinelAPILTAError("Trying to download an offline product", r)
else:
self.logger.error("Unexpected response %s from SciHub", r.status_code)
raise SentinelAPILTAError("Unexpected response from SciHub", r)
return r.status_code
url : string
URL for downloading the product
Notes
-----
https://scihub.copernicus.eu/userguide/LongTermArchive
"""
with self.session.get(url, auth=self.session.auth, timeout=self.timeout) as r:
# check https://scihub.copernicus.eu/userguide/LongTermArchive#HTTP_Status_codes
if r.status_code == 202:
self.logger.debug("Accepted for retrieval")
elif r.status_code == 403:
self.logger.debug("Requests exceed user quota")
elif r.status_code == 503:
self.logger.error("Request not accepted")
raise SentinelAPILTAError("Request for retrieval from LTA not accepted", r)
elif r.status_code == 500:
# should not happen
self.logger.error("Trying to download an offline product")
raise SentinelAPILTAError("Trying to download an offline product", r)
else:
self.logger.error("Unexpected response %s from SciHub", r.status_code)
raise SentinelAPILTAError("Unexpected response from SciHub", r)
return r.status_code
-----
https://scihub.copernicus.eu/userguide/LongTermArchive
"""
with self.session.get(url, auth=self.session.auth, timeout=self.timeout) as r:
# check https://scihub.copernicus.eu/userguide/LongTermArchive#HTTP_Status_codes
if r.status_code == 202:
self.logger.debug("Accepted for retrieval")
elif r.status_code == 403:
self.logger.debug("Requests exceed user quota")
elif r.status_code == 503:
self.logger.error("Request not accepted")
raise SentinelAPILTAError("Request for retrieval from LTA not accepted", r)
elif r.status_code == 500:
# should not happen
self.logger.error("Trying to download an offline product")
raise SentinelAPILTAError("Trying to download an offline product", r)
else:
self.logger.error("Unexpected response %s from SciHub", r.status_code)
raise SentinelAPILTAError("Unexpected response from SciHub", r)
return r.status_code