I think you could replace this block with:
```
iofile = io.BytesIO(response.content)
fitsfile = fits.open(iofile)
```

(just `import io` and `import astropy.io.fits as fits`)

see `vizier/core.py` for an example