manejo del get

parent 10def49f
......@@ -579,6 +579,13 @@ def write_execution_date(log_file='log.txt'):
with open(log_file, 'w') as file:
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
def run_update_and_report(request):
if request.method == 'POST':
......@@ -613,3 +620,5 @@ def run_update_and_report(request):
return JsonResponse({'status': 'success', 'message': f'Report generated at {json_output_path}', 'api_response': response.json()})
except Exception as e:
return JsonResponse({'status': 'error', 'message': str(e)}, status=500)
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