Skip to main content
Glama
test_notion_token.pyโ€ข1.41 kB
#!/usr/bin/env python3 """ Simple test script to verify Notion token """ import os from dotenv import load_dotenv def test_notion_token(): # Load environment load_dotenv() # Get token token = os.getenv("NOTION_API_KEY") or os.getenv("NOTION_TOKEN") print(f"๐Ÿ” Token found: {'โœ… Yes' if token else 'โŒ No'}") if not token: print("โŒ No token found in environment variables") print("๐Ÿ’ก Set NOTION_TOKEN environment variable") return False # Test basic connection try: from notion_client import Client print("โœ… notion-client imported successfully") client = Client(auth=token) print("โœ… Client created successfully") # Test API call user_info = client.users.me() print(f"โœ… API call successful!") print(f"๐Ÿ“ง User: {user_info.get('name', 'N/A')} ({user_info.get('id', 'N/A')})") return True except ImportError as e: print(f"โŒ Import error: {e}") print("๐Ÿ’ก Run: pip install notion-client") return False except Exception as e: print(f"โŒ API error: {e}") print(f"๐Ÿ“‹ Error type: {type(e).__name__}") print("๐Ÿ’ก Check your NOTION_TOKEN is valid") return False if __name__ == "__main__": success = test_notion_token() exit(0 if success else 1)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ankitmalik84/Agentic_Longterm_Memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server