Skip to content

Commit

Permalink
remove some old code, update limit
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhanson committed Aug 21, 2020
1 parent 1f2e33e commit 6d79e5c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion satsearch/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(self, *args, **kwargs):
self.output_group.add_argument('--print-md', help=h, default=None, nargs='*', dest='printmd')
h = 'Print calendar showing dates'
self.output_group.add_argument('--print-cal', help=h, dest='printcal')
#h = 'Print Item Asset definition from Collections'
self.output_group.add_argument('--save', help='Save results as GeoJSON', default=None)

def parse_args(self, *args, **kwargs):
Expand Down
5 changes: 2 additions & 3 deletions satsearch/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def collection(self, cid, headers=None):

def items(self, limit=10000, page_limit=500, headers=None):
""" Return all of the Items and Collections for this search """
found = 0 #self.found(headers=headers)
found = self.found(headers=headers)
limit = self.limit or limit
if found > limit:
logger.warning('There are more items found (%s) than the limit (%s) provided.' % (found, limit))
Expand All @@ -100,9 +100,8 @@ def items(self, limit=10000, page_limit=500, headers=None):
'merge': False
}

maxitems = limit #min(found, limit)
items = []
while nextlink and len(items) < maxitems:
while nextlink and len(items) < limit:
if nextlink.get('method', 'GET') == 'GET':
resp = self.query(url=nextlink['href'], headers=headers, **self.kwargs)
else:
Expand Down
4 changes: 0 additions & 4 deletions test/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ def test_get_ids_search(self):
assert(search.found() == 4)
assert(len(items) == 4)

#def _test_query_bad_url(self):
# with self.assertRaises(SatSearchError):
# Search.query(url=os.path.join(API_URL, 'collections/nosuchcollection'))

def test_search_query_operator(self):
expected = {'collections': ['sentinel-s2-l1c'], 'query': {'eo:cloud_cover': {'lte': '10'}, 'data_coverage': {'gt': '80'}}}
instance = Search.search(collections=['sentinel-s2-l1c'],
Expand Down

0 comments on commit 6d79e5c

Please sign in to comment.