-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We are two commented lines away from ordering pizza!
- Loading branch information
gareth
authored and
gareth
committed
Jan 9, 2011
1 parent
b7ff894
commit 6e6b52a
Showing
7 changed files
with
140 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,92 @@ | ||
# robot.py - a robot that brings you pizza | ||
# Copyright 2010 - 7cubed | ||
# Copyright 2010 - present, 7cubed | ||
# | ||
# @author gmacleod | ||
# @author bemacdo, gilbertleung, gmacleod | ||
|
||
import mechanize | ||
|
||
def getPizza(): | ||
return "Ordering a Pizza, I swear!" | ||
from model import User | ||
from model_wrapper import getUser | ||
from model_wrapper import getAddress | ||
|
||
# Gilbert & Barbara's code | ||
|
||
#br = mechanize.Browser() | ||
#br.set_handle_equiv(False) | ||
#br.set_handle_robots(False) | ||
#br.open("https://order.pizzanova.com/fcgi-bin/Weborder.pl") | ||
#br.select_form(nr=0) | ||
|
||
#br["email"] = "7cubedproject@gmail.com" | ||
#br["password"] = "velocity" | ||
#br.submit() | ||
#self.response.out.write(br.response().get_data()) | ||
import mechanize | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=0)) #delivery | ||
def getPizza(someObject, userId): | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=1)) #re-enter location | ||
#self.response.out.write(br.response().get_data()) | ||
user = getUser(userId) | ||
address = user.addressId | ||
|
||
#br.select_form(nr=0) | ||
#br["postalcode"] = "N2L 2B5" | ||
#br.find_control("LOCATIONTYPE").get("House").selected = True | ||
#br.submit() | ||
#self.response.out.write(br.response().get_data()) | ||
# Gilbert & Barbara's code | ||
|
||
#br.select_form(nr=0) | ||
#br.submit() | ||
br = mechanize.Browser() | ||
br.set_handle_equiv(False) | ||
br.set_handle_robots(False) | ||
br.open("https://order.pizzanova.com/fcgi-bin/Weborder.pl") | ||
br.select_form(nr=0) | ||
|
||
br["email"] = "7cubedproject@gmail.com" | ||
br["password"] = "velocity" | ||
br.submit() | ||
#someObject.response.out.write("Output: " + br.response().get_data()) | ||
#print "Output: " + br.response().get_data() | ||
|
||
br.select_form(nr=0) | ||
br.open(br.click(nr=0)) #delivery | ||
|
||
br.select_form(nr=0) | ||
br.open(br.click(nr=1)) #re-enter location | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
print "Postal Code: " + address.postalCode | ||
br.select_form(nr=0) | ||
br["postalcode"] = address.postalCode | ||
# TODO: make housing type customizable | ||
br.find_control("LOCATIONTYPE").get("House").selected = True | ||
br.submit() | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
br.select_form(nr=0) | ||
br.submit() | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
print "Number: " + address.number | ||
print "Phone number: " + user.phoneNumber | ||
|
||
br.select_form(nr=0) | ||
br["streetno"] = address.number | ||
br["phoneno"] = user.phoneNumber | ||
br.submit() | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
# TODO: Add checking that the street name it got is correct | ||
br.select_form(nr=0) | ||
br.open(br.click(nr=0)) # deliver (instead of re-enter) | ||
#self.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br["streetno"] = "17" | ||
#br["phoneno"] = "2268682698" | ||
#br.submit() | ||
#self.response.out.write(br.response().get_data()) | ||
br.select_form(nr=0) | ||
br.open(br.click(nr=0)) # order a pizza; | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=0)) # deliver (instead of re-enter) | ||
# TODO: make pizza order customizable | ||
br.select_form(nr=0) | ||
br.find_control("PIZZASIZE").get("Small").selected = True | ||
br.find_control("CODE03").get("On Whole Pizza").selected = True | ||
br.open(br.click(type="submit", nr=0)) # add to order | ||
#self.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=0)) # order a pizza; | ||
#self.response.out.write(br.response().get_data()) | ||
br.select_form(nr=0) | ||
br.open(br.click(type="submit", nr=6)) #proceed to chekout | ||
# someObject.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br.find_control("PIZZASIZE").get("Small").selected = True | ||
#br.find_control("CODE03").get("On Whole Pizza").selected = True | ||
#br.open(br.click(type="submit", nr=0)) # add to order | ||
#self.response.out.write(br.response().get_data()) | ||
br.select_form(nr=0) | ||
br.open(br.click(type="submit", nr=1)) #proceed to payment | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(type="submit", nr=6)) #proceed to chekout | ||
#self.response.out.write(br.response().get_data()) | ||
#br.open(br.click(nr=0)) # by cash | ||
#someObject.response.out.write(br.response().get_data()) | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(type="submit", nr=1)) #proceed to payment | ||
#self.response.out.write(br.response().get_data()) | ||
someObject.response.out.write("SUCCESS!") | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=0)) # by cash | ||
#self.response.out.write(br.response().get_data()) | ||
#DO NOT UNCOMMENT UNLESS YOU WANT TO ACTUALLY ORDER A PIZZA | ||
|
||
#br.select_form(nr=0) | ||
#br.open(br.click(nr=0)) # submit |