Skip to content

Instantly share code, notes, and snippets.

@thayton
Created February 28, 2019 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thayton/c61ec51018fc37580fac25c434380d1e to your computer and use it in GitHub Desktop.
Save thayton/c61ec51018fc37580fac25c434380d1e to your computer and use it in GitHub Desktop.
import json
import requests
class LennarScraper(object):
def __init__(self):
self.url = 'https://www.lennar.com/Services/Rest/SearchMethods.svc/GetInventoryTabDetails'
self.session = requests.Session()
self.data = {
"CommunityID":"4531",
"pageState":{
"ct":"A",
"pt": u"\u0000",
"sb":"price",
"so":"asc",
"pn":1,
"ps":17,
"ic":0,
"ss":0,
"attr":"",
"ius":False
},
"tabLocation": {
"mi":"0",
"lat":0,
"long":0
}
}
def scrape(self):
resp = self.session.post(self.url, json=self.data)
data = resp.json()
for d in data['ir']:
print d['plmktnm'] + ' - ' + d['cnm']
print d['spdAdd'] + ' ' + d['spZip'], d['city'] + ', ' + d['stcd']
print d['price']
print '\n'
if __name__ == '__main__':
scraper = LennarScraper()
scraper.scrape()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment