Skip to content

Commit

Permalink
Merge pull request #339 from mfisher87/issue-338-check-relatedurls-ex…
Browse files Browse the repository at this point in the history
…ists

Fix: Assume granules without `RelatedUrls` are not cloud hosted
  • Loading branch information
betolink authored Nov 9, 2023
2 parents 8461cfa + 82cfde1 commit 0e284e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions earthaccess/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ def _valid_state(self) -> bool:
return True

def _is_cloud_hosted(self, granule: Any) -> bool:
"""Check if a granule record in CMR advertises "direct access"."""
if "RelatedUrls" not in granule["umm"]:
return False

direct_def = "GET DATA VIA DIRECT ACCESS"
for link in granule["umm"]["RelatedUrls"]:
if "protected" in link["URL"] or link["Type"] == direct_def:
Expand Down

0 comments on commit 0e284e0

Please sign in to comment.