When using airflow http operator to hit an API endpoint in Django server, Forbidden: and 403 response is given despite of giving @cors_exempt and adding the allowed hosts. But while hitting from postman tool, the same API works without forbidden.
Any help is kindly appreciated.
Gave @cors_exempt and allowed_hosts, expect the API endpoint to execute without forbidden or 403 status and give 200 status.
Adding the following code in Django's settings.py file solved the forbidden - 403 error, in Django server for Airflow Http Operator requests:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.AllowAny',
),
}
Thank you