Created
September 16, 2020 21:14
-
-
Save skochinsky/47cbee74aa09b48d5e3170c8cc2812eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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