def getPropertyFromZpid(self, zpid): url = "http://www.zillow.com/homes/" + zpid + "_zpid/" response = requests.get(url) html = response.content #html = '<html><body><div class="something-else"><div class=" status-icon-row for-sale-row home-summary-row"></div><div class=" home-summary-row"><span class=""> $1,342,144 </span></div></div></body></html>' #bad_soup = BeautifulSoup(html, "html5lib") #soup = BeautifulSoup(bad_soup.prettify(), "html5lib") soup = BeautifulSoup(html, "lxml") property = Property() property.setID(zpid) price = self.getPriceFromWebPage(soup) property.setPrice(price) rent = self.getRentFromWebPage(soup) property.setRent(rent) print(property.getRent()) address, city, state, zip = self.getAddressFromWebPage(soup) property.setAddress(address) property.setCity(city) property.setState(state) property.setZip(zip) year, size, beds, baths = self.getOtherDetailsFromWebPage(soup) property.setYear(year) property.setSize(size) property.setBeds(beds) property.setBaths(baths) MLSNum = self.getMLSNumberFromWebPage(soup) property.setMLSNumber(MLSNum) isPreForeclosure = self.getIsPreForeclosureFromWebpage(soup) property.setIsPreForeclosure(isPreForeclosure) return property
import json from Property import Property as Props # from Players import Players #================================= props = Props() print(props.getPrice("Park_Place")) props.setOwner("Park_Place", "Alan") print(props.curOwner("Park_Place")) print(props.getRent("Park_Place")) # props.saveCurStateInJson("./guo.json") #================================= ''' player = Players() player.addPlayer("guo") player.addPlayer("alan") player.addPlayer("kevin") player.listCurentPlayers() player.updateRollDiceOrder("kevin", 1) player.updateRollDiceOrder("alan", 2) player.updateRollDiceOrder("guo", 3) player.listCurentPlayers() player.reorderPlayersAsItWasSet()