shillelagh error: 'str' object has no attribute 'items' in superset
weeebdev opened this issue · comments
Describe the bug
When I try to connect to json api like https://www.boredapi.com/api/activity?participants=1
,
it returns me "shillelagh error: 'str' object has no attribute 'items'"
To Reproduce
Steps to reproduce the behavior:
- Install superset with shillelagh
- Try to do an api request
Expected behavior
Normal api response
Desktop (please complete the following information):
- OS: Mac (Docker Actually)
- Browser [Arc]
Additional context
Here is my config in superset:
{
"connect_args": {
"adapters": [
"genericxmlapi",
"genericjsonapi",
"datasetteapi",
"weatherapi"
],
"adapter_kwargs": {
"weatherapi": { "api_key": "API_KEY" },
"genericjsonapi": {
"request_headers": {
"Content-type": "application/json"
}
}
}
Taking a look, thanks for the report!
Taking a look, thanks for the report!
Thanks a lot! I'll be very glad if you could keep me up to date about this bug. Really important to me now.
@weeebdev I have a fix here: #431
Note that you'll have to specify a different JSONPath to get it to work, since the API returns a single dictionary as the response. You'll need to use this URI: "https://www.boredapi.com/api/activity?participants=1#$"
I'll release a new version as soon as the PR is merged.
This is now fixed in 1.2.16.
@betodealmeida btw, it turned out that I faced another bug when I tried to use rest api provided by https://github.com/hapifhir/hapi-fhir
Apparently, it returns Content-Type:application/fhir+json;charset=UTF-8
while in the code it directly checks
return cls.content_type in response.headers.get("content-type", "") #72 line
Therefore, I made a quick fix via regex pattern. mylifestats@eb8eada
Please, consider fixing it.