浏览代码

merge hotfix1 into branch 0.1.1

Miek Stagl 5 年之前
父节点
当前提交
aa3800b51a
共有 2 个文件被更改,包括 34 次插入6 次删除
  1. 5 0
      CHANGELOG
  2. 29 6
      index.py

+ 5 - 0
CHANGELOG

@@ -6,6 +6,11 @@ By default, new listings are emailed.
 Results.py outputs a quick and dirty list of properties within 25 minutes to school.
 Results.py outputs a quick and dirty list of properties within 25 minutes to school.
 Search critiera can only be modified in the index.py code by adding criteria to the Search class instance.
 Search critiera can only be modified in the index.py code by adding criteria to the Search class instance.
 
 
+[hotfix 1]  11-5-2020
+
+index.py broke on multiple instances of the word 'address' on page 2 of the georgiamls listings.  Added fix to
+set the address attribute to only the first instance of the word.
+
 FUTURE GOALS
 FUTURE GOALS
 - add .conf file
 - add .conf file
   - Search criteria
   - Search criteria

+ 29 - 6
index.py

@@ -194,6 +194,7 @@ class MLSDATA:
         ba = bedbath[1][:-3]
         ba = bedbath[1][:-3]
         baths = ba							## IF House is present
         baths = ba							## IF House is present
         bedrooms = br							## IF House is present
         bedrooms = br							## IF House is present
+        address = ''
         for element in details:
         for element in details:
           if 'sqft' in element.getText():
           if 'sqft' in element.getText():
             sqft = element.findAll('td')[1].getText().strip()[:-5].replace(',','')
             sqft = element.findAll('td')[1].getText().strip()[:-5].replace(',','')
@@ -210,10 +211,12 @@ class MLSDATA:
             else:
             else:
               type = 'unknown'
               type = 'unknown'
           if 'Address' in element.getText():
           if 'Address' in element.getText():
-            address = element.findAll('td')[1]
-            street_address = list(address)[0].strip()
-            csz = list(address)[2].strip()
-            split_address = self.break_address(street_address + '|' + csz)
+            if not address:  #Prevents finding the word 'address' elsewhere in the listings
+              address = element.findAll('td')[1]
+#7              print("TEST ADDRESS: ", element)
+              street_address = list(address)[0].strip()
+              csz = list(address)[2].strip()
+              split_address = self.break_address(street_address + '|' + csz)
         description = detail_soup.find('div', {'id':'listing-remarks'}).getText().strip().replace('\t','')
         description = detail_soup.find('div', {'id':'listing-remarks'}).getText().strip().replace('\t','')
         data = Property(site_name = self.mlstype,  \
         data = Property(site_name = self.mlstype,  \
 		type = type, \
 		type = type, \
@@ -442,5 +445,25 @@ if __name__ == '__main__':
 #print()
 #print()
 #for listing in gmls.new_listings:
 #for listing in gmls.new_listings:
 #  print(listing.MLS, listing.address)
 #  print(listing.MLS, listing.address)
-
-
+#  gmls = MLSDATA('GMLS')
+#
+#  #new_properties = []
+#
+##  for county in ['Jackson']:							### FIX
+#  for county in gmls.counties:							### FIX
+#    mysearch = Search(county, type=['farm', 'house', 'land'], upper_price=525000)		### FIX
+#    mydata = gmls.getmlsdata(mysearch)
+#
+#    gmls.connectdb()
+#    gmls.dbinsert(mydata)
+#    gmls.closedb()
+#
+#  gmls.email()
+#
+#print()
+#print(str(len(gmls.new_listings)) + " new properties found!")
+#print()
+#for listing in gmls.new_listings:
+#  print(listing.MLS, listing.address)
+#
+#