Api_events port 5000 book airflow

Hi Everybody!
I’m starting to lear airflow and i’m doing the exercises/examples from the book "data pipelines with apache airflow " by Bas Harenslak. The chapter 3 first exercise (unschedule.py api_events) i can’t start because i have an error. I can’t retrive data from the local api which is in http://events_api:5000/events.
Anybody could overpass this error?

[2022-12-30 15:29:43,377] {bash.py:158} INFO - Running command: mkdir -p /data/events && curl -o /data/events.json http://events_api:5000/events
[2022-12-30 15:29:43,385] {bash.py:169} INFO - Output:
[2022-12-30 15:29:43,392] {bash.py:173} INFO -   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[2022-12-30 15:29:43,393] {bash.py:173} INFO -                                  Dload  Upload   Total   Spent    Left  Speed
[2022-12-30 15:29:53,463] {bash.py:173} INFO - 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:06 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0curl: (6) Could not resolve host: events_api

Hi @carlosirm, Bas here. Thank you for your interest in the book :slight_smile:

In short – I fixed the issue, could you pull the latest code and try again?

It turned out the issue was caused by a newer version of Jinja, which we didn’t pin to a specific version in our requirements.txt. The newer version of Jinja removed a dependency on a package called escape, which Flask was using and therefore it now failed. I bumped the Flask version which resolves the issue. More details here: python 3.x - ImportError: cannot import name 'escape' from 'jinja2' - Stack Overflow.

1 Like

Hi @BasPH ! It’s a honor to be reply by one of the author of this book. Thank you Very much, i’ll pull the code again and see what happend!