Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| # check_credentials.py - ุฃุฏุงุฉ ูุญุต ู ูู ุจูุงูุงุช ุงูุงุนุชู ุงุฏ | |
| import os | |
| import json | |
| def check_credentials(): | |
| """ูุญุต ู ูู credentials.json ูุงูุชุฃูุฏ ู ู ุตุญุชู""" | |
| print("๐ ูุญุต ู ูู ุจูุงูุงุช ุงูุงุนุชู ุงุฏ...") | |
| print("=" * 50) | |
| # ูุญุต ูุฌูุฏ ุงูู ูู | |
| if not os.path.exists('credentials.json'): | |
| print("โ ู ูู credentials.json ุบูุฑ ู ูุฌูุฏ!") | |
| print("๐ก ุชุฃูุฏ ู ู ูุถุน ุงูู ูู ูู ููุณ ู ุฌูุฏ app.py") | |
| return False | |
| print("โ ู ูู credentials.json ู ูุฌูุฏ") | |
| # ูุญุต ู ุญุชูู ุงูู ูู | |
| try: | |
| with open('credentials.json', 'r') as f: | |
| creds = json.load(f) | |
| print("โ ุงูู ูู ูุญุชูู ุนูู JSON ุตุญูุญ") | |
| # ูุญุต ุงูุจููุฉ | |
| if 'installed' not in creds: | |
| print("โ ุงูู ูู ูุง ูุญุชูู ุนูู ูุณู 'installed'") | |
| return False | |
| installed = creds['installed'] | |
| # ูุญุต ุงูุญููู ุงูู ุทููุจุฉ | |
| required_fields = ['client_id', 'client_secret', 'auth_uri', 'token_uri'] | |
| missing_fields = [] | |
| for field in required_fields: | |
| if field not in installed: | |
| missing_fields.append(field) | |
| if missing_fields: | |
| print(f"โ ุงูุญููู ุงูู ูููุฏุฉ: {', '.join(missing_fields)}") | |
| return False | |
| # ูุญุต ุฅุฐุง ูุงูุช ุงูุจูุงูุงุช ููู ูุฉ | |
| client_id = installed.get('client_id', '') | |
| client_secret = installed.get('client_secret', '') | |
| if client_id.startswith('YOUR_CLIENT_ID'): | |
| print("โ client_id ูุง ูุฒุงู ูุญุชูู ุนูู ุงูููู ุฉ ุงูุงูุชุฑุงุถูุฉ!") | |
| print("๐ก ูุฌุจ ุงุณุชุจุฏุงู ุงูู ูู ุจู ูู ุญูููู ู ู Google Cloud Console") | |
| return False | |
| if client_secret.startswith('YOUR_CLIENT_SECRET'): | |
| print("โ client_secret ูุง ูุฒุงู ูุญุชูู ุนูู ุงูููู ุฉ ุงูุงูุชุฑุงุถูุฉ!") | |
| print("๐ก ูุฌุจ ุงุณุชุจุฏุงู ุงูู ูู ุจู ูู ุญูููู ู ู Google Cloud Console") | |
| return False | |
| print("โ ุฌู ูุน ุงูุญููู ุงูู ุทููุจุฉ ู ูุฌูุฏุฉ") | |
| print(f"โ Client ID: {client_id[:20]}...") | |
| print(f"โ Project ID: {installed.get('project_id', 'ุบูุฑ ู ุญุฏุฏ')}") | |
| return True | |
| except json.JSONDecodeError: | |
| print("โ ุงูู ูู ูุง ูุญุชูู ุนูู JSON ุตุญูุญ!") | |
| return False | |
| except Exception as e: | |
| print(f"โ ุฎุทุฃ ูู ูุฑุงุกุฉ ุงูู ูู: {e}") | |
| return False | |
| def check_token(): | |
| """ูุญุต ู ูู token.json ุฅุฐุง ูุงู ู ูุฌูุฏุงู""" | |
| print("\n๐ ูุญุต ู ูู ุงูู ุตุงุฏูุฉ...") | |
| print("=" * 50) | |
| if os.path.exists('token.json'): | |
| print("โ ู ูู token.json ู ูุฌูุฏ") | |
| try: | |
| with open('token.json', 'r') as f: | |
| token = json.load(f) | |
| if 'token' in token: | |
| print("โ ูุญุชูู ุนูู ุฑู ุฒ ู ุตุงุฏูุฉ") | |
| if 'refresh_token' in token: | |
| print("โ ูุญุชูู ุนูู ุฑู ุฒ ุงูุชุญุฏูุซ") | |
| if 'expiry' in token: | |
| print(f"โฐ ุชุงุฑูุฎ ุงูุชูุงุก ุงูุตูุงุญูุฉ: {token['expiry']}") | |
| except Exception as e: | |
| print(f"โ ๏ธ ู ุดููุฉ ูู ู ูู token.json: {e}") | |
| print("๐ก ูู ููู ุญุฐู ุงูู ูู ูุฅุนุงุฏุฉ ุงูู ุตุงุฏูุฉ") | |
| else: | |
| print("โน๏ธ ู ูู token.json ุบูุฑ ู ูุฌูุฏ (ุทุจูุนู ูู ุฃูู ุงุณุชุฎุฏุงู )") | |
| def main(): | |
| print("๐ ุฃุฏุงุฉ ูุญุต ุจูุงูุงุช ุงูุงุนุชู ุงุฏ ูู Google Docs") | |
| print("=" * 60) | |
| creds_ok = check_credentials() | |
| check_token() | |
| print("\n" + "=" * 60) | |
| if creds_ok: | |
| print("๐ ู ูู ุจูุงูุงุช ุงูุงุนุชู ุงุฏ ุตุญูุญ!") | |
| print("๐ก ูู ููู ุงูุขู ุงุณุชุฎุฏุงู ุฒุฑ ุงูุชุตุฏูุฑ") | |
| else: | |
| print("โ ูุฌุจ ุฅุตูุงุญ ู ูู ุจูุงูุงุช ุงูุงุนุชู ุงุฏ ุฃููุงู") | |
| print("๐ ุฑุงุฌุน ู ูู GOOGLE_SETUP_SIMPLE.md ููุญุตูู ุนูู ุงูุชุนููู ุงุช") | |
| if __name__ == "__main__": | |
| main() |