diff --git a/mega/mega.py b/mega/mega.py index d46b434..c21e432 100644 --- a/mega/mega.py +++ b/mega/mega.py @@ -92,7 +92,10 @@ class Mega(object): files = self.api_request({'a': 'f', 'c': 1}) files_dict = {} for file in files['f']: - files_dict[file['h']] = self.process_file(file) + processed_file = self.process_file(file) + #ensure each file has a name before returning + if processed_file['a']: + files_dict[file['h']] = processed_file return files_dict def get_upload_link(self, file): diff --git a/tests.py b/tests.py index d8a4bb6..e8f2491 100644 --- a/tests.py +++ b/tests.py @@ -18,8 +18,7 @@ def test(): files = m.get_files() #example iterate over files for file in files: - if files[file]['a'] != False: - print files[file] + print files[file] ##upload file print(m.upload('tests.py'))