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 = self.api_request({'a': 'f', 'c': 1})
|
||||||
files_dict = {}
|
files_dict = {}
|
||||||
for file in files['f']:
|
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
|
return files_dict
|
||||||
|
|
||||||
def get_upload_link(self, file):
|
def get_upload_link(self, file):
|
||||||
|
|
1
tests.py
1
tests.py
|
@ -18,7 +18,6 @@ def test():
|
||||||
files = m.get_files()
|
files = m.get_files()
|
||||||
#example iterate over files
|
#example iterate over files
|
||||||
for file in files:
|
for file in files:
|
||||||
if files[file]['a'] != False:
|
|
||||||
print files[file]
|
print files[file]
|
||||||
|
|
||||||
##upload file
|
##upload file
|
||||||
|
|
Loading…
Reference in a new issue