manejo del get

parent 10def49f
...@@ -579,6 +579,13 @@ def write_execution_date(log_file='log.txt'): ...@@ -579,6 +579,13 @@ def write_execution_date(log_file='log.txt'):
with open(log_file, 'w') as file: with open(log_file, 'w') as file:
file.write(today.strftime('%Y-%m-%d')) file.write(today.strftime('%Y-%m-%d'))
from django.http import JsonResponse, HttpResponseNotAllowed
import json
import datetime
import requests
from django.core.management import call_command
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt @csrf_exempt
def run_update_and_report(request): def run_update_and_report(request):
if request.method == 'POST': if request.method == 'POST':
...@@ -612,4 +619,6 @@ def run_update_and_report(request): ...@@ -612,4 +619,6 @@ def run_update_and_report(request):
return JsonResponse({'status': 'success', 'message': f'Report generated at {json_output_path}', 'api_response': response.json()}) return JsonResponse({'status': 'success', 'message': f'Report generated at {json_output_path}', 'api_response': response.json()})
except Exception as e: except Exception as e:
return JsonResponse({'status': 'error', 'message': str(e)}, status=500) return JsonResponse({'status': 'error', 'message': str(e)}, status=500)
\ No newline at end of file
return HttpResponseNotAllowed(['POST'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment