mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
fix SSLError
This commit is contained in:
parent
80bfad8285
commit
62ae7b45ad
@ -18,6 +18,8 @@ Options:
|
|||||||
parameter in your terminal:
|
parameter in your terminal:
|
||||||
$ export HTTP_PROXY="http://10.10.1.10:3128"
|
$ export HTTP_PROXY="http://10.10.1.10:3128"
|
||||||
$ export HTTPS_PROXY="https://10.10.1.10:1080"
|
$ export HTTPS_PROXY="https://10.10.1.10:1080"
|
||||||
|
--verify <ca_bundle> Use verify to provide a CA_BUNDLE file or directory
|
||||||
|
with certificates of trusted CAs
|
||||||
--debug Print debug information
|
--debug Print debug information
|
||||||
--ignore <dirs>... Ignore extra directories, each separated by a comma
|
--ignore <dirs>... Ignore extra directories, each separated by a comma
|
||||||
--no-follow-links Do not follow symbolic links in the project
|
--no-follow-links Do not follow symbolic links in the project
|
||||||
@ -171,13 +173,13 @@ def output_requirements(imports, symbol):
|
|||||||
|
|
||||||
|
|
||||||
def get_imports_info(
|
def get_imports_info(
|
||||||
imports, pypi_server="https://pypi.python.org/pypi/", proxy=None):
|
imports, pypi_server="https://pypi.python.org/pypi/", proxy=None, verify=None):
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
for item in imports:
|
for item in imports:
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"{0}{1}/json".format(pypi_server, item), proxies=proxy)
|
"{0}{1}/json".format(pypi_server, item), proxies=proxy, verify=verify)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
if hasattr(response.content, 'decode'):
|
if hasattr(response.content, 'decode'):
|
||||||
data = json2package(response.content.decode())
|
data = json2package(response.content.decode())
|
||||||
@ -419,6 +421,7 @@ def init(args):
|
|||||||
candidates = get_pkg_names(candidates)
|
candidates = get_pkg_names(candidates)
|
||||||
logging.debug("Found imports: " + ", ".join(candidates))
|
logging.debug("Found imports: " + ", ".join(candidates))
|
||||||
pypi_server = "https://pypi.python.org/pypi/"
|
pypi_server = "https://pypi.python.org/pypi/"
|
||||||
|
verify = None
|
||||||
proxy = None
|
proxy = None
|
||||||
if args["--pypi-server"]:
|
if args["--pypi-server"]:
|
||||||
pypi_server = args["--pypi-server"]
|
pypi_server = args["--pypi-server"]
|
||||||
@ -426,6 +429,9 @@ def init(args):
|
|||||||
if args["--proxy"]:
|
if args["--proxy"]:
|
||||||
proxy = {'http': args["--proxy"], 'https': args["--proxy"]}
|
proxy = {'http': args["--proxy"], 'https': args["--proxy"]}
|
||||||
|
|
||||||
|
if args["--verify"]:
|
||||||
|
verify = args["--verify"]
|
||||||
|
|
||||||
if args["--use-local"]:
|
if args["--use-local"]:
|
||||||
logging.debug(
|
logging.debug(
|
||||||
"Getting package information ONLY from local installation.")
|
"Getting package information ONLY from local installation.")
|
||||||
@ -438,6 +444,7 @@ def init(args):
|
|||||||
if x.lower() not in [z['name'].lower() for z in local]]
|
if x.lower() not in [z['name'].lower() for z in local]]
|
||||||
imports = local + get_imports_info(difference,
|
imports = local + get_imports_info(difference,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
|
verify=verify,
|
||||||
pypi_server=pypi_server)
|
pypi_server=pypi_server)
|
||||||
# sort imports based on lowercase name of package, similar to `pip freeze`.
|
# sort imports based on lowercase name of package, similar to `pip freeze`.
|
||||||
imports = sorted(imports, key=lambda x: x['name'].lower())
|
imports = sorted(imports, key=lambda x: x['name'].lower())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user