meminsahin commited on
Commit
f9b771d
·
verified ·
1 Parent(s): 81a04a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -8,14 +8,14 @@ Original file is located at
8
  """
9
 
10
  import streamlit as st
11
- import google.generativeai as genai
12
  import requests
13
 
14
  # GenAI API anahtarını yapılandır
15
  genai.configure(api_key='AIzaSyDmDtBz5Q96JzzJHojpyR2m0KJ44TKaZm8')
16
 
17
  # Holiday API anahtarını ayarla
18
- holiday_api_key = 'a7ffbb5e-34de-4934-a4fa-3a35de185646'
19
  holiday_api_url = 'https://holidayapi.com/v1/holidays'
20
 
21
  # Uygulama başlığı
@@ -36,7 +36,8 @@ if st.button('Ask'):
36
  if st.button('New Chat'):
37
  chat = model.start_chat(history=chat.history)
38
 
39
- st.header('Holiday Information')
 
40
  date = st.text_input('Enter a date (YYYY-MM-DD):')
41
  country = st.text_input('Enter a country code (e.g., US, TR):')
42
 
@@ -49,8 +50,15 @@ if st.button('Get Holidays'):
49
  'month': date.split('-')[1],
50
  'day': date.split('-')[2]
51
  }
 
 
52
  response = requests.get(holiday_api_url, params=params)
53
-
 
 
 
 
 
54
  if response.status_code == 200:
55
  holidays = response.json().get('holidays', [])
56
  if holidays:
@@ -64,3 +72,4 @@ if st.button('Get Holidays'):
64
  else:
65
  st.write('Please enter both a date and a country code.')
66
 
 
 
8
  """
9
 
10
  import streamlit as st
11
+ import google.generativeai as genai
12
  import requests
13
 
14
  # GenAI API anahtarını yapılandır
15
  genai.configure(api_key='AIzaSyDmDtBz5Q96JzzJHojpyR2m0KJ44TKaZm8')
16
 
17
  # Holiday API anahtarını ayarla
18
+ holiday_api_key = 'YOUR_HOLIDAY_API_KEY'
19
  holiday_api_url = 'https://holidayapi.com/v1/holidays'
20
 
21
  # Uygulama başlığı
 
36
  if st.button('New Chat'):
37
  chat = model.start_chat(history=chat.history)
38
 
39
+ # Holiday API ile tatil bilgilerini almak için tarih ve ülke girişi
40
+ st.header('Holiday Information')
41
  date = st.text_input('Enter a date (YYYY-MM-DD):')
42
  country = st.text_input('Enter a country code (e.g., US, TR):')
43
 
 
50
  'month': date.split('-')[1],
51
  'day': date.split('-')[2]
52
  }
53
+
54
+ # API'ye istek yap ve yanıtı al
55
  response = requests.get(holiday_api_url, params=params)
56
+
57
+ # API isteğini ve yanıtını logla
58
+ st.write('API Request URL:', response.url)
59
+ st.write('API Response Status Code:', response.status_code)
60
+ st.write('API Response JSON:', response.json())
61
+
62
  if response.status_code == 200:
63
  holidays = response.json().get('holidays', [])
64
  if holidays:
 
72
  else:
73
  st.write('Please enter both a date and a country code.')
74
 
75
+