def _download ( url ) : fh = StringIO ( ) for line in get ( url ) : fh . write ( line ) fh . seek ( 0 ) return fh
how to download as a zip file data in python
Downloads an URL and returns a file - like object open for reading compatible with zipping . ZipFile ( it has a seek () method ) .
def _download(url):
    """Downloads an URL and returns a file-like object open for reading,
    compatible with zipping.ZipFile (it has a seek() method).
    """
    fh = StringIO()

    for line in get(url):
        fh.write(line)

    fh.seek(0)
    return fh