module filehelper.internet_helper

Inheritance diagram of pyquickhelper.filehelper.internet_helper

Short summary

module pyquickhelper.filehelper.internet_helper

Gather functions about downloading from internet, …

source on GitHub

Classes

class

truncated documentation

ReadUrlException

Raised by read_url().

Functions

function

truncated documentation

download

Downloads a small file. If url is an url, it downloads the file and returns the downloaded filename. If it has …

read_url

Reads the content of a url.

Documentation

Gather functions about downloading from internet, …

source on GitHub

exception pyquickhelper.filehelper.internet_helper.ReadUrlException[source][source]

Bases: Exception

Raised by read_url.

source on GitHub

pyquickhelper.filehelper.internet_helper.download(url, path_download='.', outfile=None, fLOG=<function noLOG>)[source][source]

Downloads a small file. If url is an url, it downloads the file and returns the downloaded filename. If it has already been downloaded, it is not downloaded again The function raises an exception if the url does not contain http:// or https:// or ftp://.

Parameters
  • url – url

  • path_download – download the file here

  • outfile – see below

  • fLOG – logging function

Returns

the filename

If outfile is None, the function will give a relative name based on the last part of the url. If outfile is “”, the function will remove every weird character. If outfile is not null, the function will use it. It will be relative to the current folder and not path_download.

source on GitHub

pyquickhelper.filehelper.internet_helper.read_url(url, encoding=None)[source][source]

Reads the content of a url.

Parameters
  • url – url

  • encoding – if None, the result type is bytes, str otherwise

Returns

str (encoding is not None) or bytes

source on GitHub