Skip to content

Instantly share code, notes, and snippets.

@joshbode
Last active April 29, 2020 10:46
Show Gist options
  • Save joshbode/22a2aa5836d6c1f65fe071aca37a4ba0 to your computer and use it in GitHub Desktop.
Save joshbode/22a2aa5836d6c1f65fe071aca37a4ba0 to your computer and use it in GitHub Desktop.
Fetch URL without curl/wget (good for Docker)
python -c "import shutil, sys, requests; x = requests.get(sys.argv[1], stream=True); shutil.copyfileobj(x.raw, (sys.stdout if x.ok else sys.stderr).buffer); sys.exit(not x.ok)" https://httpbin.org/get | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment