def search(self, omit_corners=True):
    query = {'footprint': '"Intersects(POLYGON(({0} {1},{2} {1},{2} {3},{0} {3},{0} {1})))"'.format(self.coord['W'], self.coord['S'], self.coord['E'], self.coord['N']), 'producttype': self.producttype, 'platformname': self.platform, 'beginposition': '[{} TO {}]'.format(self.inidate, self.enddate), 'cloudcoverpercentage': '[0 TO {}]'.format(self.cloud)}
    data = {'format': 'json', 'start': 0, 'rows': 100, 'limit': 100, 'orderby': '', 'q': ' '.join(['{}:{}'.format(k, v) for (k, v) in query.items()])}
    response = self.session.post((self.api_url + 'search?'), data=data, auth=(self.credentials['user'], self.credentials['password']), headers={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'})
    response.raise_for_status()
    json_feed = response.json()['feed']
    if ('entry' in json_feed.keys()):
        results = json_feed['entry']
        if isinstance(results, dict):
            results = [results]
    else:
        results = []

    def keep(r):
        for item in r['str']:
            if (item['name'] == 'size'):
                units = item['content'].split(' ')[1]
                mult = {'KB': 1, 'MB': 1000.0, 'GB': 1000000.0}[units]
                size = (float(item['content'].split(' ')[0]) * mult)
                break
        if (size > 500000.0):
            return True
        else:
            return False
    results[:] = [r for r in results if keep(r)]
    print('Found {} results from Sentinel'.format(json_feed['opensearch:totalResults']))
    print('Retrieving {} results'.format(len(results)))
    return results
def search(self, omit_corners=True):
    query = {'footprint': '"Intersects(POLYGON(({0} {1},{2} {1},{2} {3},{0} {3},{0} {1})))"'.format(self.coord['W'], self.coord['S'], self.coord['E'], self.coord['N']), 'producttype': self.producttype, 'platformname': self.platform, 'beginposition': '[{} TO {}]'.format(self.inidate, self.enddate), 'cloudcoverpercentage': '[0 TO {}]'.format(self.cloud)}
    data = {'format': 'json', 'start': 0, 'rows': 100, 'limit': 100, 'orderby': , 'q': ' '.join(['{}:{}'.format(k, v) for (k, v) in query.items()])}
    response = self.session.post((self.api_url + 'search?'), data=data, auth=(self.credentials['user'], self.credentials['password']), headers={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'})
    response.raise_for_status()
    json_feed = response.json()['feed']
    if ('entry' in json_feed.keys()):
        results = json_feed['entry']
        if isinstance(results, dict):
            results = [results]
    else:
        results = []

    def keep(r):
        for item in r['str']:
            if (item['name'] == 'size'):
                units = item['content'].split(' ')[1]
                mult = {'KB': 1, 'MB': 1000.0, 'GB': 1000000.0}[units]
                size = (float(item['content'].split(' ')[0]) * mult)
                break
        if (size > 500000.0):
            return True
        else:
            return False
    results[:] = [r for r in results if keep(r)]
    print('Found {} results from Sentinel'.format(json_feed['opensearch:totalResults']))
    print('Retrieving {} results'.format(len(results)))
    return results