Fixed the JSON output format (\n breaks JSON loading afterwards)

pull/77/head
Paul A 2017-05-02 16:27:37 +02:00
parent e86ffab5f4
commit 36cf46acd9
3 changed files with 5 additions and 10 deletions

View File

@ -19,8 +19,7 @@ def download_last(m, last, out=None):
result = m.download_last(last)
if out is None:
if 'response' in result:
for e in result['response']:
print(json.dumps(e) + '\n')
print(json.dumps(result['response']))
else:
print('No results for that time period')
exit(0)

View File

@ -18,12 +18,10 @@ def search(m, quiet, url, controller, out=None, **kwargs):
for e in result['response']:
print('{}{}{}\n'.format(url, '/events/view/', e['Event']['id']))
elif out is None:
for e in result['response']:
print(json.dumps(e) + '\n')
print(json.dumps(result['response']))
else:
with open(out, 'w') as f:
for e in result['response']:
f.write(json.dumps(e) + '\n')
f.write(json.dumps(result['response']))
if __name__ == '__main__':

View File

@ -18,12 +18,10 @@ def searchall(m, search, quiet, url, out=None):
for e in result['response']:
print('{}{}{}\n'.format(url, '/events/view/', e['Event']['id']))
elif out is None:
for e in result['response']:
print(json.dumps(e) + '\n')
print(json.dumps(result['response']))
else:
with open(out, 'w') as f:
for e in result['response']:
f.write(json.dumps(e) + '\n')
f.write(json.dumps(result['response']))
if __name__ == '__main__':