This is a development version (9.14.0.dev) and may be unstable. Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.14.0.dev / IPython / utils / openpy / read_py_url

function

IPython.utils.openpy:read_py_url

source: /IPython/utils/openpy.py :84

Signature

def   read_py_url ( url : str errors : str = replace skip_encoding_cookie : bool = True )  →  str

Summary

Read a Python file from a URL, using the encoding declared inside the file.

Parameters

url : str

The URL from which to fetch the file.

errors : str

How to handle decoding errors in the file. Options are the same as for bytes.decode(), but here 'replace' is the default.

skip_encoding_cookie : bool

If True (the default), and the encoding declaration is found in the first two lines, that line will be excluded from the output.

Returns

: A unicode string containing the contents of the file.

Aliases

  • IPython.utils.openpy.read_py_url