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

json invalid mime-type #22

Open
cranky-coder opened this issue Jun 15, 2020 · 3 comments
Open

json invalid mime-type #22

cranky-coder opened this issue Jun 15, 2020 · 3 comments

Comments

@cranky-coder
Copy link

I am running your docker version of the code running on my ubuntu 18.04 install. I have the piaware docker running on a pi with the aircraft.json and stats.json files exposed via the web interface.

When I run the docker i get the following error.

Error fetching dump1090 aircraft data: Client error 0, message='Attempt to decode JSON with unexpected mimetype: application/octet-stream', url=URL('http://192.168.2.99:8087/data/aircraft.json'), http://192.168.2.99:8087/data/aircraft.json

However, if i put that url in to any browser or use curl it returns the JSON no problem. From what I found in searching around it seems it could be related aiohttp. Seems it's possible to tell it to ignore mime-type. I tried to modify the code and do a build on my env, but was unsuccessful getting a build so i couldn't fully test.

@madzodiac
Copy link

I‘ve the same issue. Was this fixed somewhere or by someone?

@madzodiac
Copy link

I‘ve the same issue. Was this fixed somewhere or by someone?

I looked to the error messages as well as some code fragments in https://github.com/claws/dump1090-exporter/blob/master/src/dump1090exporter/exporter.py
Probably this needs a json mime type as input and not plain text: data = await resp.json()
Would it be feasible to change this to .text instead of .json?
see also https://dmitripavlutin.com/javascript-fetch-async-await/

@MaxWinterstein
Copy link

@madzodiac good start, but you mixed up Python and Javascript 😉

Your mentioned data = await resp.json() is the right place to change, see my #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants