CihanYakar commited on
Commit
ed5614d
·
1 Parent(s): 0552543
Files changed (2) hide show
  1. app/main.py +31 -3
  2. requirements.txt +2 -1
app/main.py CHANGED
@@ -28,9 +28,37 @@ if not CLAUDE_API_KEY:
28
  raise Exception("CLAUDE_API_KEY environment variable is not set")
29
 
30
 
31
- def get_current_date() -> str:
32
- """Günün tarihini YYYY-MM-DD formatında döndürür"""
33
- return datetime.now().strftime("%Y-%m-%d")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
 
36
  def load_cache() -> Dict:
 
28
  raise Exception("CLAUDE_API_KEY environment variable is not set")
29
 
30
 
31
+ def get_current_date_and_season() -> tuple:
32
+ """Günün tarihini ve mevsimini döndürür"""
33
+ from datetime import datetime
34
+ import pytz
35
+
36
+ # Türkiye saat dilimini ayarla
37
+ tz = pytz.timezone('Europe/Istanbul')
38
+ current_date = datetime.now(tz)
39
+
40
+ # Türkçe ay isimleri
41
+ months = {
42
+ 1: "Ocak", 2: "Şubat", 3: "Mart", 4: "Nisan",
43
+ 5: "Mayıs", 6: "Haziran", 7: "Temmuz", 8: "Ağustos",
44
+ 9: "Eylül", 10: "Ekim", 11: "Kasım", 12: "Aralık"
45
+ }
46
+
47
+ # Mevsimi belirle
48
+ month = current_date.month
49
+ if month in [12, 1, 2]:
50
+ season = "Kış"
51
+ elif month in [3, 4, 5]:
52
+ season = "İlkbahar"
53
+ elif month in [6, 7, 8]:
54
+ season = "Yaz"
55
+ else:
56
+ season = "Sonbahar"
57
+
58
+ # Tarih stringini formatla
59
+ date_str = f"{current_date.day} {months[current_date.month]} {current_date.year}"
60
+
61
+ return date_str, season
62
 
63
 
64
  def load_cache() -> Dict:
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  fastapi
2
  uvicorn
3
  requests
4
- python-dotenv
 
 
1
  fastapi
2
  uvicorn
3
  requests
4
+ python-dotenv
5
+ pytz