is_downloadable¶
- pyhelpers.ops.is_downloadable(url, request_field='content-type', **kwargs)[source]¶
Check if a URL leads to a webpage where downloadable content is available.
- Parameters:
url (str) – A valid URL.
request_field (str) – Name of the field/header indicating the original media type of the resource; defaults to
'content-type'
.kwargs – [Optional] Additional parameters for the function requests.head().
- Returns:
True
if the given URL leads to downloadable content,False
otherwise.- Return type:
bool
Examples:
>>> from pyhelpers.ops import is_downloadable >>> url = 'https://www.python.org/static/community_logos/python-logo-master-v3-TM.png' >>> is_downloadable(url) True >>> url = 'https://www.google.co.uk/' >>> is_downloadable(url) False