|
39 | 39 | "#| export\n", |
40 | 40 | "from fastcore.all import *\n", |
41 | 41 | "from fastcore.xdg import *\n", |
42 | | - "import secrets, webbrowser, json, httpx, io, tarfile, random, string\n", |
| 42 | + "import secrets, webbrowser, httpx, io, tarfile, random, string\n", |
43 | 43 | "from pathlib import Path\n", |
44 | 44 | "from uuid import uuid4\n", |
45 | 45 | "from time import time, sleep\n", |
|
222 | 222 | " if not PLASH_CONFIG_HOME.exists(): return print(\"No config found.\")\n", |
223 | 223 | " return print(PLASH_CONFIG_HOME.read_json().get(\"session_\", \"\"), end='')\n", |
224 | 224 | " if token:\n", |
225 | | - " PLASH_CONFIG_HOME.write_text(json.dumps({\"session_\": token.strip()}))\n", |
| 225 | + " PLASH_CONFIG_HOME.write_json({\"session_\": token.strip()})\n", |
226 | 226 | " return f\"Token saved to {PLASH_CONFIG_HOME}\"\n", |
227 | 227 | " paircode = secrets.token_urlsafe(16)\n", |
228 | 228 | " login_url = httpx.get(_endpoint(rt=f\"/cli_login?paircode={paircode}\")).text\n", |
|
231 | 231 | " \n", |
232 | 232 | " cookies = _poll_cookies(paircode)\n", |
233 | 233 | " if cookies:\n", |
234 | | - " PLASH_CONFIG_HOME.write_text(json.dumps(cookies))\n", |
| 234 | + " PLASH_CONFIG_HOME.write_json(cookies)\n", |
235 | 235 | " print(f\"Authentication successful! Config saved to {PLASH_CONFIG_HOME}\")\n", |
236 | 236 | " else: print(\"Authentication timed out.\")" |
237 | 237 | ] |
|
0 commit comments