You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "assadali007 (via GitHub)" <gi...@apache.org> on 2026/01/03 13:30:10 UTC

[D] Airflow BashOperator adds %27 to curl URL when templating dates [airflow]

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 commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Airflow BashOperator adds %27 to curl URL when templating dates [airflow]

Posted by "assadali007 (via GitHub)" <gi...@apache.org>.
GitHub user assadali007 edited a discussion: Airflow BashOperator adds %27 to curl URL when templating dates


<img width="1157" height="256" alt="Screen Shot 2026-01-03 at 6 30 50 PM" src="https://github.com/user-attachments/assets/9d660d41-0e4d-4386-ab21-dec5d4035750" />

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. on picture you could not when i click on the link on log %27 come to end it 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 commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Airflow BashOperator adds %27 to curl URL when templating dates [airflow]

Posted by "assadali007 (via GitHub)" <gi...@apache.org>.
GitHub user assadali007 edited a discussion: Airflow BashOperator adds %27 to curl URL when templating dates


<img width="1157" height="344" alt="Screen Shot 2026-01-03 at 6 35 30 PM" src="https://github.com/user-attachments/assets/a50a24a2-57f9-40a0-a90c-827e5f597e92" />

<img width="1157" height="256" alt="Screen Shot 2026-01-03 at 6 30 50 PM" src="https://github.com/user-attachments/assets/9d660d41-0e4d-4386-ab21-dec5d4035750" />

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. on picture you could not when i click on the link on log %27 come to end it 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 commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Airflow BashOperator adds %27 to curl URL when templating dates [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: Airflow BashOperator adds %27 to curl URL when templating dates

No. it's the `'` at the end is also copied to your browser and your browser converts it to url-encoded version when you click it - this has nothing to do with BashOperator. As explained in https://github.com/apache/airflow/discussions/60051 your iseeu is that you have no proper quoting of your command.

GitHub link: https://github.com/apache/airflow/discussions/60078#discussioncomment-15398218

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Airflow BashOperator adds %27 to curl URL when templating dates [airflow]

Posted by "assadali007 (via GitHub)" <gi...@apache.org>.
GitHub user assadali007 edited a discussion: Airflow BashOperator adds %27 to curl URL when templating dates


<img width="1157" height="256" alt="Screen Shot 2026-01-03 at 6 30 50 PM" src="https://github.com/user-attachments/assets/9d660d41-0e4d-4386-ab21-dec5d4035750" />

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 commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org