mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
Merge 81eaa44bec08a725b45cbd82ca889751713073c6 into 5707a39df693ddd243ddd7c47ff35ce66d25a6c6
This commit is contained in:
commit
eaec1df7d7
@ -21,6 +21,7 @@ Options:
|
|||||||
$ export HTTPS_PROXY="https://10.10.1.10:1080"
|
$ export HTTPS_PROXY="https://10.10.1.10:1080"
|
||||||
--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.
|
||||||
|
--ignore-cert-errors Ignore SSL certificate errors
|
||||||
--no-follow-links Do not follow symbolic links in the project
|
--no-follow-links Do not follow symbolic links in the project
|
||||||
--encoding <charset> Use encoding parameter for file open
|
--encoding <charset> Use encoding parameter for file open
|
||||||
--savepath <file> Save the list of requirements in the given file
|
--savepath <file> Save the list of requirements in the given file
|
||||||
@ -178,13 +179,13 @@ def output_requirements(imports):
|
|||||||
|
|
||||||
|
|
||||||
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, verification=True):
|
||||||
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=verification)
|
||||||
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())
|
||||||
@ -390,6 +391,7 @@ def clean(file_, imports):
|
|||||||
|
|
||||||
|
|
||||||
def init(args):
|
def init(args):
|
||||||
|
verification = not args.get('--ignore-cert-errors')
|
||||||
encoding = args.get('--encoding')
|
encoding = args.get('--encoding')
|
||||||
extra_ignore_dirs = args.get('--ignore')
|
extra_ignore_dirs = args.get('--ignore')
|
||||||
follow_links = not args.get('--no-follow-links')
|
follow_links = not args.get('--no-follow-links')
|
||||||
@ -426,7 +428,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,
|
||||||
pypi_server=pypi_server)
|
pypi_server=pypi_server, verification=verification)
|
||||||
|
|
||||||
path = (args["--savepath"] if args["--savepath"] else
|
path = (args["--savepath"] if args["--savepath"] else
|
||||||
os.path.join(input_path, "requirements.txt"))
|
os.path.join(input_path, "requirements.txt"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user