pyrolite.util.web

pyrolite.util.web.urlify(url)[source]

Strip a string to return a valid URL.

pyrolite.util.web.internet_connection(target='pypi.org', secure=True)[source]

Tests for an active internet connection, based on an optionally specified target.

Parameters

target (str) – URL to check connectivity, defaults to www.google.com

Returns

Boolean indication of whether a HTTP connection can be established at the given url.

Return type

bool

pyrolite.util.web.download_file(url: str, encoding='UTF-8', postprocess=None)[source]

Downloads a specific file from a url.

Parameters
  • url (str) – URL of specific file to download.

  • encoding (str) – String encoding.

  • postprocess (callable) – Callable function to post-process the requested content.