-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
63 lines (50 loc) · 1.53 KB
/
main.py
File metadata and controls
63 lines (50 loc) · 1.53 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
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Instagram Profile Statistics Viewer
A desktop application for looking up Instagram profile statistics
through HikerAPI with CSV export capabilities.
Usage:
python main.py --api-key YOUR_API_KEY
"""
import argparse
import sys
import tkinter as tk
from typing import Optional
from src.infrastructure.api.hiker_api_client import HikerApiClient
from src.infrastructure.export.csv_exporter import CsvExporter
from src.application.profile_service import ProfileService
from src.presentation.main_window import MainWindow
def parse_arguments() -> argparse.Namespace:
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
description="Instagram Profile Statistics Viewer"
)
parser.add_argument(
"--api-key",
required=True,
help="HikerAPI authentication key"
)
return parser.parse_args()
def main() -> None:
"""Application entry point."""
args = parse_arguments()
# Initialize dependencies
api_client = HikerApiClient(api_key=args.api_key)
csv_exporter = CsvExporter()
profile_service = ProfileService(api_client=api_client)
# Start the UI
root = tk.Tk()
root.title("Instagram Profile Statistics")
root.geometry("1024x768")
app = MainWindow(
master=root,
profile_service=profile_service,
exporter=csv_exporter
)
root.mainloop()
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)