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

API is returning JSON with Python bytes delimiters #147

Open
pkgw opened this issue May 16, 2023 · 2 comments
Open

API is returning JSON with Python bytes delimiters #147

pkgw opened this issue May 16, 2023 · 2 comments

Comments

@pkgw
Copy link

pkgw commented May 16, 2023

(Apologies if I'm not reporting this in the right repo.)

The esahubble.org site, which I believe runs Djangoplicity, returns incorrect JSON in its image API results. For instance, here:

https://esahubble.org/images/heic1806a/api/json/

the JSON contains the following text:

"Title": "b'A ghostly galaxy lacking dark matter'"

This appears in many, but not all, of the output fields. I guess there's some code that is receiving Python bytes variables when it should be receiving Unicode strings?

@EdisonArango
Copy link
Member

EdisonArango commented May 16, 2023

Hi, Peter(@pkgw), thank you for reporting this issue,
Indeed ESA/Hubble runs Djangoplicity, so let me contact the ESA/Hubble team so that they can perhaps solve this issue ASAP.

But in any case, I'm currently working on a new, more efficient version of the API that we will first release to https://noirlab.edu/ and possibly to ESA/Hubble in the future. Then might I ask:

Which other endpoint are you using? perhaps this one https://esahubble.org/images/d2d/ for listing the images?
Would there be an issue for you if we define new URLs like this: "/api/v2/avm/images/" "/api/v2/avm/images/-id-/"?

Regards,
Edison

@pkgw
Copy link
Author

pkgw commented May 17, 2023

Hi Edison,

Thanks for the prompt reply! Right now, the only endpoint we're using is the image metadata one like in my example. We are actually listing images by manually scraping Djangoplicity's search page, since I wasn't aware of the d2d endpoint.

New URLs would not be a problem for us. Our code that relies on the APIs is internal backend stuff that we could migrate as needed.

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

2 participants