Skip to content

Exception when using pip_index_url with token #5

@robin-moss

Description

@robin-moss

When using gitlabform I get the follow exception during it's version check (this check uses luddite)

http.client.InvalidURL: nonnumeric port: '[MASKED]@internal.repo'

We have two environment variables:

  • PIP_INDEX_URL = https://username:password@internal.repo/repository/pypi/simple
  • PIP_INDEX = https://username:password@internal.repo/repository/pypi/

It looks like the Python client __get_hostport is the cause of the error as it looks for a : and expects the right-hand side to be the port.

Full stack trace:

Traceback (most recent call last):
  File "/usr/local/bin/gitlabform", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/gitlabform/bin/gitlabform", line 6, in <module>
    GitLabForm().main()
  File "/gitlabform/gitlabform/gitlabform/core.py", line 48, in __init__
    print(self.get_version(self.skip_version_check))
  File "/gitlabform/gitlabform/gitlabform/core.py", line 178, in get_version
    latest_version = luddite.get_version_pypi("gitlabform")
  File "/usr/local/lib/python3.8/site-packages/luddite-1.0.1-py3.8.egg/luddite.py", line 105, in get_version_pypi
    latest = get_data_pypi(name, index)["info"]["version"]
  File "/usr/local/lib/python3.8/site-packages/luddite-1.0.1-py3.8.egg/luddite.py", line 94, in get_data_pypi
    data = json_get(uri)
  File "/usr/local/lib/python3.8/site-packages/luddite-1.0.1-py3.8.egg/luddite.py", line 79, in json_get
    response = urlopen(request)
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 1397, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/local/lib/python3.8/urllib/request.py", line 1323, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)
  File "/usr/local/lib/python3.8/http/client.py", line 1382, in __init__
    super(HTTPSConnection, self).__init__(host, port, timeout,
  File "/usr/local/lib/python3.8/http/client.py", line 833, in __init__
    (self.host, self.port) = self._get_hostport(host, port)
  File "/usr/local/lib/python3.8/http/client.py", line 876, in _get_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: '[MASKED]@internal.repo'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions