You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/13 23:18:03 UTC
[GitHub] [airflow] ToxaZ opened a new issue #8861: Misleading HttpHook.run method signature
ToxaZ opened a new issue #8861:
URL: https://github.com/apache/airflow/issues/8861
**Apache Airflow version**: 1.10.10
**What happened**:
Execution of HttpHook leads to error (on the API serverside):
```
{"Error":"Could not read JSON: Unrecognized token 'format': was expecting 'null', 'true', 'false' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@50edfaf7; line: 1, column: 8]; nested exception is org.codehaus.jackson.JsonParseException: Unrecognized token 'format': was expecting 'null', 'true', 'false' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@50edfaf7; line: 1, column: 8]"}
```
The reason was providing `dict` instead of `JSON formatted str`
**What you expected to happen**:
Currently HttpHook.run [provides](https://github.com/apache/airflow/blob/96697180d79bfc90f6964a8e99f9dd441789177c/airflow/hooks/http_hook.py#L93) the following docstring:
```
:param data: payload to be uploaded or request parameters
:type data: **dict**
```
which is misleading since that would cause mentioned error, it should actually be a `:type data: **json**`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on issue #8861: Misleading HttpHook.run method signature
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-628294761
Thanks for opening your first issue here! Be sure to follow the issue template!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ToxaZ commented on issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
ToxaZ commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-632084696
@ashb but the functionatliy of HttpHook.run is still broken. I don't insist on fixing it, just fyi.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-629650281
@saurabh7248 I assigned you to this ticket.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
ashb commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-631766490
I don't think anything needs doing, the hook already supports extra arguments https://github.com/apache/airflow/blob/96697180d79bfc90f6964a8e99f9dd441789177c/airflow/hooks/http_hook.py#L100-L101
The request docs you linked to:
> :param data: the body to attach to the request. If a dictionary or
> list of tuples ``[(key, value)]`` is provided, form-encoding will
> take place.
Passing data is doing what is says -- _form_ encoding, as if this was a `<form>` submitted by a browser.
If you want to submit json as the body, do `hook.run(json={'a': [1,2,3]})'
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-628375097
Interesting. Do you want to work on it? Can I assign you to this ticket?
Here is contributor guide: https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] saurabh7248 commented on issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
saurabh7248 commented on issue #8861:
URL: https://github.com/apache/airflow/issues/8861#issuecomment-629645918
Hey @mik-laj, can I try my hand at fixing this?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb closed issue #8861: HttpHook.run method doesn't convert dict in 'data' parameter to json object
Posted by GitBox <gi...@apache.org>.
ashb closed issue #8861:
URL: https://github.com/apache/airflow/issues/8861
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org