fundamentals.download.extract_filename_from_url

Try and extract the name of the document located at the given URL

Author

David Young

Module Contents

Functions

extract_filename_from_url

get the filename from a URL.

API

fundamentals.download.extract_filename_from_url.extract_filename_from_url(log, url)[source][source]

get the filename from a URL.

Will return ‘untitled.html’, if no filename is found.

Key Arguments

  • url – the url to extract filename from

Returns: - filename – the filename

Usage

from fundamentals.download import extract_filename_from_url
name = extract_filename_from_url(
    log=log,
    url="https://en.wikipedia.org/wiki/Docstring"
)
print name
# OUT: Docstring.html