mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
add warnings to for remote resolving mode
This commit is contained in:
parent
6cd9925a31
commit
da442e7a2a
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python: Current File",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"cwd": "${workspaceFolder}\\pipreqs",
|
||||||
|
"justMyCode": true,
|
||||||
|
"args": ["C:/Users/Strawberry/Desktop/projects/pipreqs-vulnerable", "--print"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -176,6 +176,7 @@ def get_imports_info(
|
|||||||
|
|
||||||
for item in imports:
|
for item in imports:
|
||||||
try:
|
try:
|
||||||
|
logging.warning('Import "%s" not found locally. Trying to resolve it at the PyPI server.', item)
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"{0}{1}/json".format(pypi_server, item), proxies=proxy)
|
"{0}{1}/json".format(pypi_server, item), proxies=proxy)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
@ -187,9 +188,15 @@ def get_imports_info(
|
|||||||
raise HTTPError(status_code=response.status_code,
|
raise HTTPError(status_code=response.status_code,
|
||||||
reason=response.reason)
|
reason=response.reason)
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
logging.debug(
|
logging.warning(
|
||||||
'Package %s does not exist or network problems', item)
|
'Package "%s" does not exist or network problems', item)
|
||||||
continue
|
continue
|
||||||
|
logging.warning('Import "%s" was resolved to "%s:%s" package (%s).\nPlease, verify manually the final list of requirements.txt to avoid possible dependency confusions.',
|
||||||
|
item,
|
||||||
|
data.name,
|
||||||
|
data.latest_release_id,
|
||||||
|
data.pypi_url
|
||||||
|
)
|
||||||
result.append({'name': item, 'version': data.latest_release_id})
|
result.append({'name': item, 'version': data.latest_release_id})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user