()
| 86 | |
| 87 | |
| 88 | def _build_headers() -> dict: |
| 89 | account_prefix = _account_prefix() |
| 90 | headers = { |
| 91 | "Content-Type": "application/x-www-form-urlencoded", |
| 92 | "Origin": "https://gemini.google.com", |
| 93 | "Referer": f"https://gemini.google.com{account_prefix}/app", |
| 94 | "X-Same-Domain": "1", |
| 95 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", |
| 96 | } |
| 97 | if account_prefix: |
| 98 | headers["X-Goog-AuthUser"] = str(CONFIG["auth_user"]) |
| 99 | cookie_str, sapisid = load_cookie() |
| 100 | if cookie_str: |
| 101 | headers["Cookie"] = cookie_str |
| 102 | if sapisid: |
| 103 | headers["Authorization"] = make_sapisidhash(sapisid) |
| 104 | return headers |
| 105 | |
| 106 | |
| 107 | def _build_payload(prompt: str, model_id: int, think_mode: int, file_refs: list = None, extra_fields: dict = None) -> str: |
no test coverage detected