get_files() updated to check each file has a name, thanks jlejeune
This commit is contained in:
parent
0cd6daae39
commit
4128609e5d
2 changed files with 5 additions and 3 deletions
|
@ -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):
|
||||
|
|
3
tests.py
3
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'))
|
||||
|
|
Loading…
Reference in a new issue