Detail: WWW: Constructor

Overview: WWW: Constructor

classmethod WWW.from_file(url, *, encoding='utf-8', in_memory=None, buffer_size=8192, fp=None)[source]

Given a URL, return a loadable component, either as an in-memory store (a StringIO or BytesIO) or a disk-based store (either to a provided file path or or managed temporary file that will be deleted after being read).

Parameters:
  • url – A URL string or a Request object from Python’s standard library urllib.

  • encoding – Specify the encoding of the resource to be delivered to the caller. If encoding is None, the resource is treated as binary.

  • in_memory – Define if data should be written to disk (reducing RAM usage) or held in memory until loaded.

  • buffer_size – When in_memory is False, the number of bytes to be written per network read

  • fp – Optionally specify a file path to write to; cannot be specified if in_memory is True. When reading from archives (zip, gzip), only the extracted component will be written to this file path.

classmethod WWW.from_gzip(url, *, encoding='utf-8', in_memory=None, buffer_size=8192, fp=None)[source]

Given a URL, return a loadable component, either as an in-memory store (a StringIO or BytesIO) or a disk-based store (either to a provided file path or or managed temporary file that will be deleted after being read).

Parameters:
  • url – A URL string or a Request object from Python’s standard library urllib.

  • encoding – Specify the encoding of the resource to be delivered to the caller. If encoding is None, the resource is treated as binary.

  • in_memory – Define if data should be written to disk (reducing RAM usage) or held in memory until loaded.

  • buffer_size – When in_memory is False, the number of bytes to be written per network read

  • fp – Optionally specify a file path to write to; cannot be specified if in_memory is True. When reading from archives (zip, gzip), only the extracted component will be written to this file path.

classmethod WWW.from_zip(url, *, encoding='utf-8', in_memory=None, buffer_size=8192, fp=None, component=None)[source]

Given a URL, return a loadable component, either as an in-memory store (a StringIO or BytesIO) or a disk-based store (either to a provided file path or or managed temporary file that will be deleted after being read).

Parameters:
  • url – A URL string or a Request object from Python’s standard library urllib.

  • encoding – Specify the encoding of the resource to be delivered to the caller. If encoding is None, the resource is treated as binary.

  • in_memory – Define if data should be written to disk (reducing RAM usage) or held in memory until loaded.

  • buffer_size – When in_memory is False, the number of bytes to be written per network read

  • fp – Optionally specify a file path to write to; cannot be specified if in_memory is True. When reading from archives (zip, gzip), only the extracted component will be written to this file path.

  • component – When reading from a ZIP, specify the name of the component to load; if not specified and only one component exists, that component will be used.

WWW: Constructor