astropy/astropy — pull request #1258 by keflavich (2013-07-13 10:07:48+00:00)
Title: Allow timeout to be specified as a keyword argument in data utils

For astroquery, there are times we need to directly use `get_readable_fileobj`, e.g. on ftp urls, since `requests` does not support these and we want to avoid using additional libraries.

We need to be able to specify timeouts in individual requests. `astroquery` has both global and service-specific timeout configurables, and I think these should not override astropy's `REMOTE_TIMEOUT`, since they may be for URL requests rather than data download requests.

This PR allows `timeout=` keywords to the `astropy.data.utils` functions. The timeouts default to `REMOTE_TIMEOUT()`; this approach is probably not ideal since the default will be set at import time and never updated if the configurable is changed interactively. Perhaps `timeout=` should default to `timeout=None` and there should be a clause like this:
```
if timeout is None:
timeout = REMOTE_TIMEOUT()
```? I haven't implemented this because I'd like to receive feedback first on whether that's the best approach (but it's trivial to implement)