open_remote_file#
- gwpy.io.pelican.open_remote_file(
- url: str,
- *,
- federation: str | None = None,
- cache: bool | Literal['update'] = False,
- show_progress: bool = False,
- **kwargs,
Download a remote file from a Pelican federation (and open it).
This function is a wrapper around
astropy.utils.data.get_readable_fileobjthat uses requests-pelican to resolve the actual HTTP(S) URLs and pass those as thesourceskeyword toget_readable_fileobj().Also, if the Pelican director informs that an authorisation token is required, this function attempts to an HTTP
Authorizationheader using a locally-discoveredSciToken(requires igwn-auth-utils).- Parameters:
- url
str The name of the resource to access. Must be a Pelican federation URL, either using the
pelican://scheme or a federation scheme understood byrequests-pelican(e.g.osdf://), or thefederationkeyword must be provided.- federation: `str`, optional
The URL of the federation. This is required if
urldoes not include federation information.- cache
bool,"update", optional Whether to cache the contents of remote URLs.
- show_progress: `bool`, optional
Print verbose progress information to the screen.
- kwargs
All other positional and keyword arguments are passed directly to
astropy.utils.data.get_readable_fileobj.
- url
- Returns:
- filefile-like
The file opened in binary format.