GitHub user assadali007 created a discussion: Airflow BashOperator adds %27 to
curl URL when templating dates
I’m learning BashOperator to fetch data per day from the local API using
data_interval_start and data_interval_end.
When the task runs, the rendered curl command contains an extra %27
(URL-encoded single quote) at the end of the URL, which breaks the request.
`fetch_events = BashOperator(
task_id="fetch_events",
bash_command=(
"mkdir -p /data/events && "
"curl -o /data/events.json "
"http://events_api:5000/events?"
"start_date={{data_interval_start.strftime('%Y-%m-%d')}}&"
"end_date={{data_interval_end.strftime('%Y-%m-%d')}}"
),
dag=dag,
)
`
GitHub link: https://github.com/apache/airflow/discussions/60078
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]