Skip to content

Commit

Permalink
Check for name attribute in source parameter.
Browse files Browse the repository at this point in the history
Before trying to use it, return None if it's not there.

Fixes #6106
  • Loading branch information
jralls committed Mar 22, 2024
1 parent 442116a commit e0f2015
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def get_package_categories(self, for_lockfile=False):
return ["packages", "dev-packages"] + list(package_categories)

def get_requests_session_for_source(self, source):
if not (source and source.get("name")):
return None
if self.sessions.get(source["name"]):
session = self.sessions[source["name"]]
else:
Expand Down Expand Up @@ -268,6 +270,8 @@ def get_hash_from_link(self, hash_cache, link):
def get_hashes_from_pypi(self, ireq, source):
pkg_url = f"https://pypi.org/pypi/{ireq.name}/json"
session = self.get_requests_session_for_source(source)
if not session:
return None
try:
collected_hashes = set()
# Grab the hashes from the new warehouse API.
Expand Down

0 comments on commit e0f2015

Please sign in to comment.