From: BenoƮt Fontaine Date: Sat, 10 Nov 2018 19:03:56 +0000 (+0100) Subject: Fix an error when changes.json doesn't return datas (status code 204) X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=3b87242d0ae02b588bd9fcba2e8cdffcbf0ad552;p=gamesguru%2Fgetmyancestors.git Fix an error when changes.json doesn't return datas (status code 204) --- diff --git a/getmyancestors.py b/getmyancestors.py index 5ff62a7..244ac79 100755 --- a/getmyancestors.py +++ b/getmyancestors.py @@ -558,9 +558,10 @@ class Indi: def get_contributors(self): temp = set() data = self.tree.fs.get_url('/platform/tree/persons/%s/changes.json' % self.fid) - for entries in data['entries']: - for contributors in entries['contributors']: - temp.add(contributors['name']) + if data: + for entries in data['entries']: + for contributors in entries['contributors']: + temp.add(contributors['name']) if temp: text = '=== ' + self.tree.fs._('Contributors') + ' ===\n' + '\n'.join(sorted(temp)) for n in self.tree.notes: @@ -678,9 +679,10 @@ class Fam: if self.fid: temp = set() data = self.tree.fs.get_url('/platform/tree/couple-relationships/%s/changes.json' % self.fid) - for entries in data['entries']: - for contributors in entries['contributors']: - temp.add(contributors['name']) + if data: + for entries in data['entries']: + for contributors in entries['contributors']: + temp.add(contributors['name']) if temp: text = '=== ' + self.tree.fs._('Contributors') + ' ===\n' + '\n'.join(sorted(temp)) for n in self.tree.notes: