Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions combined.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
import requests
from google import genai
from google.genai import types

# Set environment variables
TRIPADVISOR_API_KEY = os.getenv('TRIPADVISOR_API_KEY')
GENAI_KEY = os.getenv('GENAI_KEY')

# Create an genAI client
genai.api_key = GENAI_KEY
client = genai.Client(
api_key=GENAI_KEY,
)

cy = input("Enter the city that youre looking suggestions for: ")
cate = input("What are you looking for — a hotel, restaurant, or attraction? ")

url = "https://api.content.tripadvisor.com/api/v1/location/search?language=en"
data = {
'key': TRIPADVISOR_API_KEY,
'searchQuery': cy,
'category': cate
}

response = requests.get(url, params=data)

print(response.json())

prompt = (
f"recommend the top {cate} "
f"in {cy} and explain why it's better."
)

# Specify the model to use and the messages to send
response = client.models.generate_content(
model="gemini-2.5-flash",
config=types.GenerateContentConfig(
system_instruction=(
"You are a nice travel assistant who gives helpful suggestions."
)
),
contents=prompt,
)

print(response.text)
6 changes: 3 additions & 3 deletions tripadvisor_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import requests


TRIPADVISOR_API_KEY = os.getenv('TRIPADVISOR_API_KEY')
'''print("API KEY:", TRIPADVISOR_API_KEY)'''
'''TRIPADVISOR_API_KEY = '6587D61217FA4ED8A4113B9511202EE7'''

'''print("API KEY:", TRIPADVISOR_API_KEY)
TRIPADVISOR_API_KEY = '6587D61217FA4ED8A4113B9511202EE7'''

url = "https://api.content.tripadvisor.com/api/v1/location/search?language=en"

Expand Down