how to pass csrf token in post request django

# Step 1: Import necessary modules
from django.middleware.csrf import get_token
import requests

# Step 2: Get CSRF token
csrf_token = get_token()

# Step 3: Set CSRF token in headers
headers = {'X-CSRFToken': csrf_token}

# Step 4: Define the data payload for the POST request
data = {'key1': 'value1', 'key2': 'value2'}

# Step 5: Make the POST request with CSRF token in headers
response = requests.post('https://your-api-endpoint.com/', data=data, headers=headers)

# Step 6: Check the response
if response.status_code == 200:
    print('POST request successful')
else:
    print('POST request failed. Status code:', response.status_code)
    print('Response content:', response.text)