functions

Helper functions for mygeodb projects.

functions.download(url: url, destination: path, if_exists='exit', proxies=None) bool[source]

Downloads a file from the internet.

Parameters
  • url (url (string)) – The file location on the internet

  • destination (path) – Where to put the file

  • if_exists ({'exit','replace'}, default='exit') – What to do if the destination file already exists ? If if_exists='exit', then the process is aborted before the download even starts. If if_exists='replace', then the destination file is replaced by the download.

Returns

True if the operation succeeded; False otherwise.

Return type

bool

functions.getLogger(logFile)[source]

Get a logger. Log messages are sent both to the standard output and to a logFile.

Parameters

logFile (path) – The path to the log file. Eg: ./log/myProgram. The iso date + .log extension will be added to the path.

Returns

The logger

Return type

Logger

Example
>>> from statbel.functions import getLogger
>>> logging=getLogger('./log/myProgram') 
>>> logging.info('This is an info line') 
functions.unzip(zipped: path, unzipped: path) None[source]

Unzips an archive to a directory.

Parameters
  • zipped (path) – Path to the zipped archive

  • unzipped (path) – Directory to unzip the file

Returns

None