{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function is a context manager, and should be used for example as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "with get_readable_fileobj('file.dat') as f:\n    contents = f.read()",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If a URL is provided and the cache is in use, the provided URL will be the name used in the cache. The contents may already be stored in the cache under this URL provided, they may be downloaded from this URL, or they may be downloaded from one of the locations listed in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "sources"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". See "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "~download_file",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for details."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "file",
              "annotation": ":term:`file-like (readable)`",
              "desc": []
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Yield a readable, seekable file-like object from a file or URL."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "name_or_obj",
              "annotation": "str or file-like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The filename of the file to access (if given as a string), or the file-like object to access."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If a file-like object, it must be opened in binary mode."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "encoding",
              "annotation": "str, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "None",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (default), returns a file-like object with a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "read"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method that returns "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "str",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unicode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") objects, using "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "locale.getpreferredencoding",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "locale",
                        "version": "*",
                        "kind": "api",
                        "path": "locale:getpreferredencoding"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " as an encoding.  This matches the default behavior of the built-in "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "open",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " when no "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "mode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " argument is provided."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'binary'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", returns a file-like object where its "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "read"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method returns "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "bytes",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " objects."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When another string, it is the name of an encoding, and the file-like object's "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "read"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method will return "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "str",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unicode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") objects, decoded from binary using the given encoding."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "cache",
              "annotation": "bool or \"update\", optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Whether to cache the contents of remote URLs. If \"update\", check the remote URL for a new version but store the result in the cache."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "show_progress",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Whether to display a progress bar if the file is downloaded from a remote server.  Default is "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "True",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "remote_timeout",
              "annotation": "float",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Timeout for remote requests in seconds (default is the configurable "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "astropy.utils.data.Conf.remote_timeout",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "sources",
              "annotation": "list of str, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If provided, a list of URLs to try to obtain the file from. The result will be stored under the original URL. The original URL will "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "not"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " be tried unless it is in this list; this is to prevent long waits for a primary server that is known to be inaccessible at the moment."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "http_headers",
              "annotation": "dict or None",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "HTTP request headers to pass into "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "urlopen"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if needed. (These headers are ignored if the protocol for the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "name_or_obj"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "/"
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "sources"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " entry is not a remote HTTP URL.) In the default case (None), the headers are "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "User-Agent: some_value"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Accept: */*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "some_value"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is set by "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "astropy.utils.data.conf.default_http_user_agent"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "use_fsspec",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Use "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "fsspec.open",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to open the file? Defaults to "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "False",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " unless "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "name_or_obj"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " starts with the Amazon S3 storage prefix "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "s3://"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or the Google Cloud Storage prefix "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "gs://"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  Can also be used for paths with other prefixes (e.g. "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "http://"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") but in this case you must explicitly pass "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "use_fsspec=True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Use of this feature requires the optional "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fsspec"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " package. A "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ModuleNotFoundError"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be raised if the dependency is missing."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 5.2"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "fsspec_kwargs",
              "annotation": "dict, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Keyword arguments passed on to "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "fsspec.open",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This can be used to configure cloud storage credentials and caching behavior. For example, pass "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fsspec_kwargs={\"anon\": True}"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to enable anonymous access to Amazon S3 open data buckets. See "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fsspec"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "'s documentation for available parameters."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 5.2"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "close_files",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Close the file object when exiting the context manager. Default is "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "True",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 5.2"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This supports passing filenames, URLs, and readable file-like objects, any of which can be compressed in gzip, bzip2 or lzma (xz) if the appropriate compression libraries are provided by the Python installation."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/astropy/utils/data.py",
  "item_line": 200,
  "item_type": "function",
  "aliases": [
    "astropy.io.fits.file.get_readable_fileobj"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "name_or_obj",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "encoding",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "cache",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "show_progress",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "True"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "remote_timeout",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "sources",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "http_headers",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "use_fsspec",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "fsspec_kwargs",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "close_files",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "True"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "get_readable_fileobj"
  },
  "references": null,
  "qa": "astropy.utils.data:get_readable_fileobj",
  "arbitrary": [],
  "local_refs": [
    "cache",
    "close_files",
    "encoding",
    "file",
    "fsspec_kwargs",
    "http_headers",
    "name_or_obj",
    "remote_timeout",
    "show_progress",
    "sources",
    "use_fsspec"
  ]
}