Download Files with zagoload

The zagoload allows to access local files and remote files – files which are accessible thought HTTP and FTP protocols – in uniform way.

Version Python github Build Status

Installing zagoload

The zagoload module can be installed by pip:

 # pip install zagoload

You can also clone zagoload github repo.


To download URL, we will use zagoload.loads(url) which return new FileRequest object.

  • If the file was successfully downloaded, FileRequest.valid will be True.
  • The FileRequest.source will point to the source file
  • The will point to the downloaded local file on disk. It will downloaded to cache under uniquely generated name
  • The will contain the contents of the file

In the next example we will download
 import zagoload

 def download(source):
   def info(ss):
     import sys ;sys.stdout.write(ss + u'\n')

   ff = zagoload.load(source)

   if ff.valid:
     # if valid, process - the file on disk
     info( 'Download {0} => {1}'.format(ff.source, )
     # or process ff.text - the content of the file
     info( u'{0} characters : {1}'.format(len(ff.text),ff.text[:15].__repr__() ) )
     info('Failed to download {0}'.format(ff.source))

 download(u'' )
 download(u'') output
 # python
 Download => Cache/fW/file_fWebvNyPE1OGX2RS.bin
 44994 characters : '<!doctype html>'
 Download => Cache/sH/file_sHDLNozuH0CkIMUA.bin
 147316 characters : '\n              '