GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: option to add a helper to lookup token · python-gitlab/python-gitlab@8ecf559

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs
    • cli-usage.rst
  • gitlab
    • config.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/cli-usage.rst‎

Copy file name to clipboardExpand all lines: docs/cli-usage.rst
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ example:
4848
4949
[elsewhere]
5050
url = http://else.whe.re:8080
51-
private_token = CkqsjqcQSFH5FQKDccu4
51+
private_token = lookup: pass show path/to/password
5252
timeout = 1
5353
5454
The ``default`` option of the ``[global]`` section defines the GitLab server to
Collapse file

‎gitlab/config.py‎

Copy file name to clipboardExpand all lines: gitlab/config.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import os
1919
import configparser
20+
import subprocess
2021
from typing import List, Optional, Union
2122

2223
from gitlab.const import USER_AGENT
@@ -150,6 +151,16 @@ def __init__(
150151
except Exception:
151152
pass
152153

154+
for attr in ("job_token", "http_password", "private_token", "oauth_token"):
155+
value = getattr(self, attr)
156+
prefix = "lookup:"
157+
if isinstance(value, str) and value.lower().strip().startswith(prefix):
158+
helper = value[len(prefix) :].strip()
159+
value = (
160+
subprocess.check_output(helper, shell=True).decode("utf-8").strip()
161+
)
162+
setattr(self, attr, value)
163+
153164
self.api_version = "4"
154165
try:
155166
self.api_version = self._config.get("global", "api_version")

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.