Created
February 28, 2019 15:24
-
-
Save thayton/c61ec51018fc37580fac25c434380d1e to your computer and use it in GitHub Desktop.
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
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