Error about Task 10 in Web API Documentation

HE ZHENTAO
  • 1
  • 23 Jun

I tried to reproduce the contents of Taxt10, but it failed.
The reason for this is that the 'get()' function cannot read 'png_url = sub['supplementary_data']['stellar_mocks']['image_fof']';
try replacing 'fof' with 'gz' was didn't work.
The error is displayed as

 Requests.exceptions.TooManyRedirects: Exceeded 30 redirects.

I don't know what the reason is.
I hope you can answer this.

Thank you

Dylan Nelson
  • 23 Jun

Hello,

Thanks for pointing this out, you're right there was an issue accessing these older Illustris "FITS" images on www.tng-project.org. Should be all fixed now.

HE ZHENTAO
  • 1
  • 24 Jun

Hello Dylan

Thank you for you suggestion.

After debugging I found that it was because of the python version.
There was a major update to the StringIO function in python 3, which caused my python 3.8.5 to get an error after parsing the binary file using the StringIO function. But setting the function call to python3 format.

from io import StringIO

and then change

file_object = StringIO(response.content)

to the line

file_object = io.BytesIO(response.content)

After that I was able to get a good result.
I hope to add python3 related comments after this part.

Dylan Nelson
  • 24 Jun

Thanks for this update, you're right it was very old Python2 code! I've updated the documentation.

  • Page 1 of 1