Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken json_client #17527

Closed
sw1010 opened this issue Aug 10, 2021 · 2 comments · Fixed by #17529
Closed

Broken json_client #17527

sw1010 opened this issue Aug 10, 2021 · 2 comments · Fixed by #17529
Labels
kind:bug This is a clearly a bug

Comments

@sw1010
Copy link
Contributor

sw1010 commented Aug 10, 2021

Apache Airflow version: 2.1.2

Apache Airflow Provider versions (please include all providers that are relevant to your bug):
apache-airflow-providers-ftp==2.0.0
apache-airflow-providers-imap==2.0.0
apache-airflow-providers-sqlite==2.0.0

Environment:

  • OS (e.g. from /etc/os-release): Ubuntu
  • Python: python 3.8
  • httpx: httpx==0.6.8, httpx==0.18.2

What happened:

Traceback (most recent call last):
  File "./bug.py", line 6, in <module>
    response = airflow_client.trigger_dag(
  File "/home/user/my_project/venv38/lib/python3.8/site-packages/airflow/api/client/json_client.py", line 54, in trigger_dag
    data = self._request(
  File "/home/user/my_project/venv38/lib/python3.8/site-packages/airflow/api/client/json_client.py", line 38, in _request
    if not resp.ok:
AttributeError: 'Response' object has no attribute 'ok'

Json Client depends on httpx, which doesn't provide the attribute 'ok' and according to their spec (https://www.python-httpx.org/compatibility/) they are not going to do that. In the consequence handling the response crashes.

What you expected to happen:

The expected outcome is to handle the response smoothly.

How to reproduce it:

#!/usr/bin/env python3

from airflow.api.client import json_client

airflow_client = json_client.Client("http://rnd.airflow.mydomain.com", None)
response = airflow_client.trigger_dag("my_dag", execution_date="2021-04-27T00:00:00")

Anything else we need to know:
The problem always occurs.

@sw1010 sw1010 added the kind:bug This is a clearly a bug label Aug 10, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 10, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@uranusjr
Copy link
Member

This was probably missed when we migrated from requests to httpx. Would you be able to submit a pull request for this?

kaxil pushed a commit that referenced this issue Aug 10, 2021
The json_client depends on httpx and thus the response doesn't contain
the attribute 'ok'. In consequence, the missing attribute has been changed
to is_error.

closes: #17527

Co-authored-by: Szymon Wojciechowski <szymon.wojciechowski@here.com>
jhtimmins pushed a commit that referenced this issue Aug 12, 2021
The json_client depends on httpx and thus the response doesn't contain
the attribute 'ok'. In consequence, the missing attribute has been changed
to is_error.

closes: #17527

Co-authored-by: Szymon Wojciechowski <szymon.wojciechowski@here.com>
(cherry picked from commit fbddefe)
jhtimmins pushed a commit that referenced this issue Aug 13, 2021
The json_client depends on httpx and thus the response doesn't contain
the attribute 'ok'. In consequence, the missing attribute has been changed
to is_error.

closes: #17527

Co-authored-by: Szymon Wojciechowski <szymon.wojciechowski@here.com>
(cherry picked from commit fbddefe)
kaxil pushed a commit that referenced this issue Aug 17, 2021
The json_client depends on httpx and thus the response doesn't contain
the attribute 'ok'. In consequence, the missing attribute has been changed
to is_error.

closes: #17527

Co-authored-by: Szymon Wojciechowski <szymon.wojciechowski@here.com>
(cherry picked from commit fbddefe)
jhtimmins pushed a commit that referenced this issue Aug 17, 2021
The json_client depends on httpx and thus the response doesn't contain
the attribute 'ok'. In consequence, the missing attribute has been changed
to is_error.

closes: #17527

Co-authored-by: Szymon Wojciechowski <szymon.wojciechowski@here.com>
(cherry picked from commit fbddefe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants