This is inspired by Daniel Holth's module httpfile and is based on the discussion over https://github.com/pypa/pip/issues/7819