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
37 changes: 37 additions & 0 deletions Project1-PairProgramming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'''Codio Day5 module: Google GenAI API.'''

import os
from google import genai
from google.genai import types

# Set environment variables
my_api_key = os.getenv('GENAI_KEY')
genai.api_key = my_api_key

# Create an genAI client using the key from our environment variable
client = genai.Client(
api_key=my_api_key,
)

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

# AI Prompt
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)
22 changes: 22 additions & 0 deletions tripadvisor_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import requests


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

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

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

data = {
'key': TRIPADVISOR_API_KEY,
'searchQuery': cy,
'category': cate
}

response = requests.get(url, params=data)
print(response.status_code)
print(response.json())