21 lines
540 B
Python
21 lines
540 B
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
def test_env():
|
|
# Load environment variables
|
|
load_dotenv()
|
|
|
|
# Get the API key
|
|
api_key = os.getenv('OPENAI_API_KEY')
|
|
|
|
print("Environment variable details:")
|
|
print(f"1. API key exists: {api_key is not None}")
|
|
if api_key:
|
|
print(f"2. API key length: {len(api_key)}")
|
|
print(f"3. First 8 chars: {api_key[:8]}")
|
|
print(f"4. Last 8 chars: {api_key[-8:]}")
|
|
print(f"5. Raw value: {repr(api_key)}")
|
|
|
|
if __name__ == "__main__":
|
|
test_env()
|