kleinkram 0.48.1__py3-none-any.whl → 0.49.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of kleinkram might be problematic. Click here for more details.

kleinkram/auth.py CHANGED
@@ -13,7 +13,7 @@ from kleinkram.config import get_config
13
13
  from kleinkram.config import save_config
14
14
 
15
15
  CLI_CALLBACK_ENDPOINT = "/cli/callback"
16
- OAUTH_SLUG = "/auth/google?state=cli"
16
+ OAUTH_SLUG = "/auth/"
17
17
 
18
18
 
19
19
  def _has_browser() -> bool:
@@ -80,7 +80,9 @@ def _browser_auth(*, url: str) -> None:
80
80
  print(f"Authentication complete. Tokens saved to {CONFIG_PATH}.")
81
81
 
82
82
 
83
- def login_flow(*, key: Optional[str] = None, headless: bool = False) -> None:
83
+ def login_flow(
84
+ *, oAuthProvider: str, key: Optional[str] = None, headless: bool = False
85
+ ) -> None:
84
86
  config = get_config()
85
87
  # use cli key login
86
88
  if key is not None:
@@ -88,7 +90,7 @@ def login_flow(*, key: Optional[str] = None, headless: bool = False) -> None:
88
90
  save_config(config)
89
91
  return
90
92
 
91
- oauth_url = f"{config.endpoint.api}{OAUTH_SLUG}"
93
+ oauth_url = f"{config.endpoint.api}{OAUTH_SLUG}{oAuthProvider}?state=cli"
92
94
  if not headless and _has_browser():
93
95
  _browser_auth(url=oauth_url)
94
96
  else:
kleinkram/cli/app.py CHANGED
@@ -127,10 +127,24 @@ def base_handler(exc: Exception) -> int:
127
127
 
128
128
  @app.command(rich_help_panel=CommandTypes.AUTH)
129
129
  def login(
130
+ oAuthProvider: str = typer.Option(
131
+ "google",
132
+ "--oauth-provider",
133
+ "-p",
134
+ help="OAuth provider to use for login. Supported providers: google, github.",
135
+ show_default=True,
136
+ ),
130
137
  key: Optional[str] = typer.Option(None, help="CLI key"),
131
138
  headless: bool = typer.Option(False),
132
139
  ) -> None:
133
- login_flow(key=key, headless=headless)
140
+
141
+ # validate oAuthProvider
142
+ if oAuthProvider not in ["google", "github"]:
143
+ raise typer.BadParameter(
144
+ f"Unsupported OAuth provider '{oAuthProvider}'. Supported providers: google, github."
145
+ )
146
+
147
+ login_flow(oAuthProvider=oAuthProvider, key=key, headless=headless)
134
148
 
135
149
 
136
150
  @app.command(rich_help_panel=CommandTypes.AUTH)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kleinkram
3
- Version: 0.48.1
3
+ Version: 0.49.0
4
4
  Summary: give me your bags
5
5
  Author: Cyrill Püntener, Dominique Garmier, Johann Schwabe
6
6
  Author-email: pucyril@ethz.ch, dgarmier@ethz.ch, jschwab@ethz.ch
@@ -1,7 +1,7 @@
1
1
  kleinkram/__init__.py,sha256=xIJqTJw2kbCGryGlCeAdpmtR1FTxmrW1MklUNQEaj74,1061
2
2
  kleinkram/__main__.py,sha256=B9RiZxfO4jpCmWPUHyKJ7_EoZlEG4sPpH-nz7T_YhhQ,125
3
3
  kleinkram/_version.py,sha256=QYJyRTcqFcJj4qWYpqs7WcoOP6jxDMqyvxLY-cD6KcE,129
4
- kleinkram/auth.py,sha256=XD_rHOyJmYYfO7QJf3TLYH5qXA22gXGWi7PT3jujlVs,2968
4
+ kleinkram/auth.py,sha256=PdSYZZO8AauNLZbn9PBgPM3o-O_nwoOKTj94EGnPRE8,3003
5
5
  kleinkram/config.py,sha256=nx6uSM5nLP4SKe8b9VAx4KDtCCwtyshXmzbEJcUwpsY,7411
6
6
  kleinkram/core.py,sha256=COJcUx8tP6EQIyg4OiVprJfQUCMbiq2QGB9xZ2CPUCo,9621
7
7
  kleinkram/errors.py,sha256=qa98YvhDbLqX60P8bcMcFmHy4HxgYNlSROXud8Kj-P4,965
@@ -28,7 +28,7 @@ kleinkram/cli/_mission.py,sha256=zDFnOozOFckpuREFgIPt1IzG5q3b1bsNxYlWQoHoz5A,530
28
28
  kleinkram/cli/_project.py,sha256=N0C96NC_onCEwTteYp2wgkkwkdJt-1q43LFdqNXfjC8,3398
29
29
  kleinkram/cli/_upload.py,sha256=gOhbjbmqhmwW7p6bWlSvI53vLHvBFO9QqD1kdU92I2k,2813
30
30
  kleinkram/cli/_verify.py,sha256=n9QThY0JnqaIqw6udYXdRQGcpUl2lIbFXGQIgpTnDPE,2112
31
- kleinkram/cli/app.py,sha256=m2qq4z95QllvXnxh3koPp0kq06I5R9etsJV8qSV8TMk,7037
31
+ kleinkram/cli/app.py,sha256=8GSawKoX9PuyeOOf2Hq7dEfuqPHZkgGL0xvaFpxl4go,7508
32
32
  kleinkram/cli/error_handling.py,sha256=wK3tzeKVSrZm-xmiyzGLnGT2E4TRpyxhaak6GWGP7P8,1921
33
33
  testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  testing/backend_fixtures.py,sha256=t5QWwyezHUhxxAlbUuE_eFmpyRaGbnWNNcGPwrO17JM,1571
@@ -43,8 +43,8 @@ tests/test_printing.py,sha256=kPzpIQOtQJ9yQ32mM8cMGDVOGsbrZZLQhfsXN1Pe68Q,2231
43
43
  tests/test_query.py,sha256=fExmCKXLA7-9j2S2sF_sbvRX_2s6Cp3a7OTcqE25q9g,3864
44
44
  tests/test_utils.py,sha256=eUBYrn3xrcgcaxm1X4fqZaX4tRvkbI6rh6BUbNbu9T0,4784
45
45
  tests/test_wrappers.py,sha256=TbcTyO2L7fslbzgfDdcVZkencxNQ8cGPZm_iB6c9d6Q,2673
46
- kleinkram-0.48.1.dist-info/METADATA,sha256=Jd0LlnLCBHtwi8WdCRNXALcNoDXFP2oZPPRDRehYQpM,2828
47
- kleinkram-0.48.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- kleinkram-0.48.1.dist-info/entry_points.txt,sha256=SaB2l5aqhSr8gmaMw2kvQU90a8Bnl7PedU8cWYxkfYo,46
49
- kleinkram-0.48.1.dist-info/top_level.txt,sha256=N3-sJagEHu1Tk1X6Dx1X1q0pLDNbDZpLzRxVftvepds,24
50
- kleinkram-0.48.1.dist-info/RECORD,,
46
+ kleinkram-0.49.0.dist-info/METADATA,sha256=syrGgyWNJkxISFlQicFErPveh3ZOiCn5OJy7TOI1QKk,2828
47
+ kleinkram-0.49.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
+ kleinkram-0.49.0.dist-info/entry_points.txt,sha256=SaB2l5aqhSr8gmaMw2kvQU90a8Bnl7PedU8cWYxkfYo,46
49
+ kleinkram-0.49.0.dist-info/top_level.txt,sha256=N3-sJagEHu1Tk1X6Dx1X1q0pLDNbDZpLzRxVftvepds,24
50
+ kleinkram-0.49.0.dist-info/RECORD,,