GitHub user assadali007 created a discussion: Why does Airflow BashOperator 
fetch multiple days of data when API URL has single-day date range?


I am learning Apache Airflow and created a simple DAG to fetch daily events 
from a REST API.When I call the API directly in the browser, it correctly 
returns one day of data 
http://localhost:5000/events?start_date=2019-01-01&end_date=2019-01-02
`
[
  {
    "date": "2019-01-01",
    "user": "user1"
  }
]
`



However, when I call the same API URL using an Airflow BashOperator, the output 
file contains data from 2019-01-01 to 2019-01-05, which is unexpected.
`dag = DAG(
    dag_id="04_time_delta",
    schedule_interval='@daily',
    start_date=dt.datetime(2026,1,1)
)

fetch_events = BashOperator(
    task_id ='fetch_events',
    bash_command=(
        "mkdir -p /Users/asadali/data/events && "
         "curl -o /Users/asadali/data/events/events.json 
http://localhost:5000/events?";
         "start_date=2019-01-01&"
         "end_date=2019-01-02"
    ),
    dag = dag
)
<img width="974" height="355" alt="Screen Shot 2026-01-02 at 6 15 47 PM" 
src="https://github.com/user-attachments/assets/32704d7a-47de-4f08-87d1-c62d90b7cd48";
 />
<img width="982" height="485" alt="Screen Shot 2026-01-02 at 6 16 40 PM" 
src="https://github.com/user-attachments/assets/b5b59058-4647-4cbf-bef5-a3e02947f85c";
 />
`

fetch_events

GitHub link: https://github.com/apache/airflow/discussions/60051

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to