Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import sqlite3, json, urllib
conn = sqlite3.connect('chatbot.db')
c = conn.cursor()
# Based off https://stackoverflow.com/questions/31696411/google-maps-directions-python
# urrllib is a package that collects several modules for working with URLs
from urllib.parse import urlencode
import googlemaps
#start = input()
#end = "coventry"
#url = 'http://maps.googleapis.com/maps/api/directions/json?%s' % urlencode((
# ('origin', start),
# ('destination', end)
#))
#with urllib.request.urlopen(url) as ur:
# ur = ur.read().decode('utf-8')
#print(ur)
#result = json.loads(ur)
#for i in range(0, len (result['routes'][0]['legs'][0]['steps'])):
# j = result['routes'][0]['legs'][0]['steps'][i]['html_instructions']
# print (j)
def restuarants():
response = input("Who are you going out to eat with? \n")
words = response.split(" ")
if "boyfriend" in words or "girlfriend" in words:
print("The restaurants below have been selected as being suited for you.")
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Romantic" '):
print(row)
elif "friend" in words or "friends" in words:
print("The restaurants below have been selected as being suited for you.")
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Casual" '):
print(row)
elif "myself" in words or "alone" in words:
print("The restaurants below have been selected as being suited for you.")
for row in c.execute('SELECT name FROM restaurants WHERE mood = "Cosy" '):
print(row)
else:
print("This is not an option")
restuarants()