Skip to content

Commit

Permalink
Merge pull request #6114 from jralls/source-name
Browse files Browse the repository at this point in the history
Check for name attribute in source parameter.
  • Loading branch information
matteius authored Mar 27, 2024
2 parents 442116a + e0f2015 commit 73220cc
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 73220cc

Please sign in to comment.