return only content
This commit is contained in:
parent
7dad61e6e6
commit
762c9308ab
@ -57,17 +57,14 @@ def write_json(data):
|
|||||||
output = os.path.join(_path, '{}.json'.format(data['date']))
|
output = os.path.join(_path, '{}.json'.format(data['date']))
|
||||||
|
|
||||||
if os.path.isfile(output) and data == read_json(data['date']):
|
if os.path.isfile(output) and data == read_json(data['date']):
|
||||||
return Response({
|
return Response(
|
||||||
'detail': 'Playlist from {} already exists'.format(data['date'])
|
{'detail': 'Playlist from {} already exists'.format(data['date'])})
|
||||||
}, status=status.HTTP_204_NO_CONTENT)
|
|
||||||
|
|
||||||
|
|
||||||
with open(output, "w") as outfile:
|
with open(output, "w") as outfile:
|
||||||
json.dump(data, outfile, indent=4)
|
json.dump(data, outfile, indent=4)
|
||||||
|
|
||||||
return Response({
|
return Response({'detail': 'Playlist from {} saved'.format(data['date'])})
|
||||||
'detail': 'Playlist from {} saved'.format(data['date'])
|
|
||||||
}, status=status.HTTP_201_CREATED)
|
|
||||||
|
|
||||||
|
|
||||||
def read_log(type, _date):
|
def read_log(type, _date):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user