Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POETRY_HTTP_BASIC_ environment variables are ignored for private repositories #2988

Closed
3 tasks done
willemt opened this issue Sep 28, 2020 · 2 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected
Milestone

Comments

@willemt
Copy link

willemt commented Sep 28, 2020

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: travis-ci-sardonyx-xenial (happening in CI)

  • Poetry version: 1.1.0rc1

  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

Poetry 1.1.0rc1 is ignoring POETRY_HTTP_BASIC_XXX_PASSWORD and POETRY_HTTP_BASIC_XXX_USERNAME

I'm getting HTTP 401 when running poetry install.

Works fine on 1.0.10.

  HTTPError

  401 Client Error: Unauthorized for url: https://xxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev/packages/xxx-0.1.61-py3-none-any.whl

  at ~/virtualenv/python3.7.1/lib/python3.7/site-packages/requests/models.py:941 in raise_for_status
      937│         elif 500 <= self.status_code < 600:
      938│             http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
      939│
      940│         if http_error_msg:
    → 941│             raise HTTPError(http_error_msg, response=self)
      942│
      943│     def close(self):
      944│
      945│         called the underlying ``raw`` object must not be accessed again.

Stack trace (apologies for the artefacts in the left column):


  8  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:179 in _execute_operation
      177│ 
      178│             try:
    → 179│                 result = self._do_execute_operation(operation)
      180│             except EnvCommandError as e:
      181│                 if e.e.returncode == -2:

  7  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:253 in _do_execute_operation
      251│             return 0
      252│ 
    → 253│         result = getattr(self, "_execute_{}".format(method))(operation)
      254│ 
      255│         if result != 0:

  6  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:388 in _execute_install
      386│ 
      387│     def _execute_install(self, operation):  # type: (Install) -> None
    → 388│         return self._install(operation)
      389│ 
      390│     def _execute_update(self, operation):  # type: (Update) -> None

  5  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:414 in _install
      412│             archive = self._download_link(operation, Link(package.source_url))
      413│         else:
    → 414│             archive = self._download(operation)
      415│ 
      416│         operation_message = self.get_operation_message(operation)

  4  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:568 in _download
      566│         link = self._chooser.choose_for(operation.package)
      567│ 
    → 568│         return self._download_link(operation, link)
      569│ 
      570│     def _download_link(self, operation, link):

  3  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:577 in _download_link
      575│             # No cached distributions was found, so we download and prepare it
      576│             try:
    → 577│                 archive = self._download_archive(operation, link)
      578│             except BaseException:
      579│                 cache_directory = self._chef.get_cache_directory_for_link(link)

  2  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/executor.py:604 in _download_archive
      602│     def _download_archive(self, operation, link):  # type: (Operation, Link) -> Path
      603│         response = self._authenticator.request(
    → 604│             "get", link.url, stream=True, io=self._sections.get(id(operation), self._io)
      605│         )
      606│         wheel_size = response.headers.get("content-length")

  1  ~/virtualenv/python3.7.1/lib/python3.7/site-packages/poetry/installation/authenticator.py:80 in request
       78│             else:
       79│                 if resp.status_code not in [502, 503, 504] or is_last_attempt:
    →  80│                     resp.raise_for_status()
       81│                     return resp
       82│ 

  HTTPError

  401 Client Error: Unauthorized for url: https://xxx.execute-api.ap-northeast-1.amazonaws.com/dev/packages/xxx-0.1.61-py3-none-any.whl

  at ~/virtualenv/python3.7.1/lib/python3.7/site-packages/requests/models.py:941 in raise_for_status
      937│         elif 500 <= self.status_code < 600:
      938│             http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
      939│ 
      940│         if http_error_msg:
    → 941│             raise HTTPError(http_error_msg, response=self)
      942│ 
      943│     def close(self):
      944│         
      945│         called the underlying ``raw`` object must not be accessed again.
@willemt willemt added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 28, 2020
@abn
Copy link
Member

abn commented Sep 28, 2020

Duplicate of #2799

Thank you for the detailed report @willemt.

@abn abn marked this as a duplicate of #2799 Sep 28, 2020
abn added a commit to abn/poetry that referenced this issue Sep 28, 2020
This change unifies the use of authenticator for legacy repositories.
This ensures that we retrieve the correct credentials in all cases.

Relates-to: python-poetry#2799 python-poetry#2988
@abn abn closed this as completed Sep 29, 2020
@abn abn removed the status/triage This issue needs to be triaged label Sep 29, 2020
@abn abn added this to the 1.1 milestone Sep 29, 2020
Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants