drobert commented on a change in pull request #19053:
URL: https://github.com/apache/airflow/pull/19053#discussion_r732250067



##########
File path: docs/apache-airflow/tutorial.rst
##########
@@ -410,23 +431,25 @@ Let's break this down into 2 steps: get data & merge data:
 
   @task
   def get_data():
+      # NOTE: configure this as appropriate for your airflow environment
       data_path = "/usr/local/airflow/dags/files/employees.csv"
 
       url = 
"https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/pipeline_example.csv";
 
-      response = requests.request("GET", url)
-
-      with open(data_path, "w") as file:
-          for row in response.text.split("\n"):
-              if row:
-                  file.write(row + "\n")
+      with requests.get(url, stream=True) as req:
+          req.raise_for_status()
+          with open("/opt/airflow/dags/files/employees.csv", "wb") as file:

Review comment:
       Good catch, thanks.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to