Closed as not planned
Description
Description of the problem, including code/CLI snippet
I have to access our gitlab server on port 7443, but urllib3 tries on 443 and I can't change the port.
How can I change the port?
My code (I had to modify hostname):
GITLAB_URL = 'https://foo.bar'
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
gl = gitlab.Gitlab(GITLAB_URL, private_token=GITLAB_TOKEN, ssl_verify=False)
projects = gl.projects.list(all=True)
The error in CLI (I had to modify username and hostname):
Traceback (most recent call last):
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
conn = connection.create_connection(
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
raise err
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
conn.connect()
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 309, in connect
conn = self._new_conn()
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002033C9897C0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 440, in send
resp = conn.urlopen(
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
retries = retries.increment(
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='foo.bar', port=443):
Max retries exceeded with url: /api/v4/projects?membership=false&order_by=created_at&owned=false&page=2&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false
(Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002033C9897C0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../checkout.py", line 29, in <module>
projects = gl.projects.list(all=True)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\exceptions.py", line 311, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\mixins.py", line 241, in list
obj = self.gitlab.http_list(path, **data)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\client.py", line 821, in http_list
return list(GitlabList(self, url, query_data, **kwargs))
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\client.py", line 1076, in __next__
return self.next()
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\client.py", line 1087, in next
self._query(self._next_url, **self._kwargs)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\client.py", line 994, in _query
result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\gitlab\client.py", line 680, in http_request
result = self.session.request(
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "C:\Users\foo\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='foo.bar', port=443): Max retries exceeded with url:
/api/v4/projects?membership=false&order_by=created_at&owned=false&page=2&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false
(Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002033C9897C0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
Specifications
- OS: Windows 10 21H1
- python version: 3.8.10
- python-gitlab version: 3.3.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): GitLab Community Edition 14.9.2