-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathsetup_env.py
More file actions
executable file
·48 lines (40 loc) · 1.41 KB
/
setup_env.py
File metadata and controls
executable file
·48 lines (40 loc) · 1.41 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
#!/usr/bin/env python3
"""
Helper script to set up Instagram credentials in a .env file.
"""
import os
import getpass
def setup_env():
"""Interactive setup for Instagram credentials."""
print("Instagram DM MCP - Environment Setup")
print("=" * 40)
print()
# Check if .env already exists
if os.path.exists('.env'):
print("⚠️ .env file already exists!")
overwrite = input("Do you want to overwrite it? (y/N): ").lower().strip()
if overwrite != 'y':
print("Setup cancelled.")
return
# Get credentials
print("Please enter your Instagram credentials:")
username = input("Instagram Username: ").strip()
password = getpass.getpass("Instagram Password: ").strip()
if not username or not password:
print("❌ Username and password are required!")
return
# Write to .env file
env_content = f"""# Instagram Credentials
INSTAGRAM_USERNAME={username}
INSTAGRAM_PASSWORD={password}
"""
try:
with open('.env', 'w') as f:
f.write(env_content)
print("✅ .env file created successfully!")
print("🔒 Your credentials are now stored securely in the .env file")
print("📝 Remember to add .env to your .gitignore if it's not already there")
except Exception as e:
print(f"❌ Error creating .env file: {e}")
if __name__ == "__main__":
setup_env()