Skip to content

Instantly share code, notes, and snippets.

@skochinsky
Created September 16, 2020 21:14
Show Gist options
  • Save skochinsky/47cbee74aa09b48d5e3170c8cc2812eb to your computer and use it in GitHub Desktop.
Save skochinsky/47cbee74aa09b48d5e3170c8cc2812eb to your computer and use it in GitHub Desktop.
import zipfile
import httpio
import sys
def usage():
print("httpzip.py <url> [filename]")
if len(sys.argv)>1:
url = sys.argv[1]
else:
usage()
if len(sys.argv)>2:
fname = sys.argv[2]
else:
fname = None
with httpio.open(url) as fp:
zf = zipfile.ZipFile(fp)
if not fname:
zf.printdir()
else:
zf.extract(fname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment