Skip to content

Conversation

AndyLem
Copy link

@AndyLem AndyLem commented Jun 16, 2025

Pull Request Check List

Resolves: Authorization error accessing when using http-basic repository and credentials configuration

  • Added tests for changed code.
  • Updated documentation for changed code.

Summary by Sourcery

Bug Fixes:

  • Fix authorization failures by constructing request URLs with credentials when using HTTP BASIC repositories.

Copy link

sourcery-ai bot commented Jun 16, 2025

Reviewer's Guide

Updated HTTP repository request URL construction to use the authenticated_url property for endpoints, ensuring HTTP Basic credentials are included when accessing the repository.

Class diagram for updated HTTP repository URL usage

classDiagram
    class HttpRepository {
        - _url: str
        - authenticated_url: str
        - session: requests.Session
        + _get_response(endpoint: str): requests.Response | None
        ...
    }
    HttpRepository : _get_response now uses authenticated_url for requests
Loading

File-Level Changes

Change Details Files
Construct request URLs using authenticated_url instead of raw URL
  • Replaced url assignment in _get_response to use authenticated_url + endpoint
  • Ensures HTTP Basic credentials are applied to repository requests
src/poetry/repositories/http_repository.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @AndyLem - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -401,7 +401,7 @@ def calculate_sha256(self, link: Link) -> str | None:
return None

def _get_response(self, endpoint: str) -> requests.Response | None:
url = self._url + endpoint
url = self.authenticated_url + endpoint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is always correct? There is also

request = requests.auth.HTTPBasicAuth(
credential.username or "", credential.password or ""
)(request)

which seems to handle HTTP basic auth by adding a header if I understand correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants