GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — policyengine.py/scripts/check_release_credentials.py at main · PolicyEngine/policyengine.py Expand file tree/ Copy pathcheck_release_credentials.pyMore file actions 51 lines (42 loc) · 1.56 KB / Copy pathcheck_release_credentials.pyFile metadata and controls51 lines (42 loc) · 1.56 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 """Verify the trusted release job's Hugging Face credential has read-only scope.""" from __future__ import annotations import os import sys import requests def check_read_only_token(token: str | None) -> None: if not token or not token.strip(): raise ValueError( "Full private release verification requires HUGGING_FACE_TOKEN" ) try: response = requests.get( "https://huggingface.co/api/whoami-v2", headers={"Authorization": f"Bearer {token}"}, timeout=30, allow_redirects=False, ) if response.status_code != 200: raise ValueError payload = response.json() auth = payload.get("auth", {}) if ( auth.get("type") != "access_token" or auth.get("accessToken", {}).get("role") != "read" ): raise ValueError except (requests.RequestException, ValueError, TypeError, AttributeError): # Never include the response, account, token, or request exception in CI # output. Unknown and fine-grained permission schemas fail closed. raise ValueError( "Release verification requires an authenticated Hugging Face access token with role read" ) from None def main() -> int: try: check_read_only_token(os.environ.get("HUGGING_FACE_TOKEN")) except ValueError as exc: print(str(exc), file=sys.stderr) return 1 print("Verified read-only Hugging Face release credential") return 0 if __name__ == "__main__": raise SystemExit(main()) |
| You are visitor 01402792 — 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. |