def download(self):
    results = self.search()
    if (not isinstance(results, list)):
        results = [results]
    downloaded_data = [f for f in os.listdir(self.output_path) if os.path.isfile(os.path.join(self.output_path, f))]
    s2_tiles = []
    for r in results:
        (url, tile_id) = (r['link'][0]['href'], r['title'])
        save_dir = os.path.join(self.output_path, '{}.zip'.format(tile_id))
        if ('{}.tif'.format(tile_id) in downloaded_data):
            print('File {} already downloaded'.format(tile_id))
            continue
        print('Downloading {} ...'.format(tile_id))
        s2_tiles.append(tile_id)
        response = self.session.get(url, stream=True, allow_redirects=True, auth=(self.credentials['user'], self.credentials['password']))
        with open(save_dir, 'wb') as f:
            f.write(response.content)
    return s2_tiles
def download(self):
    results = self.search()
    if (not isinstance(results, list)):
        results = [results]
    downloaded_data = [f for f in os.listdir(self.output_path) if os.path.isfile(os.path.join(self.output_path, f))]
    s2_tiles = []
    for r in results:
        (url, tile_id) = (r['link'][0]['href'], r['title'])
        save_dir = os.path.join(self.output_path, '{}.zip'.format(tile_id))
        if ('{}.tif'.format(tile_id) in downloaded_data):
            print('File {} already downloaded'.format(tile_id))
            continue
        print('Downloading {} ...'.format(tile_id))
        s2_tiles.append(tile_id)
        response = self.session.get(url, stream=True, allow_redirects=True, auth=(self.credentials['user'], self.credentials['password']))
        with open(save_dir, 'wb') as f:
            f.write(response.content)
    return s2_tiles