Ver código fonte

Hotfix 1 - fix address on some gmls listings.

Miek Stagl 5 anos atrás
pai
commit
4337e41bdc
2 arquivos alterados com 34 adições e 4 exclusões
  1. 26 0
      CHANGELOG
  2. 8 4
      index.py

+ 26 - 0
CHANGELOG

@@ -0,0 +1,26 @@
+[0.1.0] Initial Commit  9-4-2020
+
+Working Commit.  Allows user to call index.py a get results returned into mysql database 'landsearch.'
+  Results contain listing informationa and link, plus Google API time/distance to school and work
+By default, new listings are emailed.
+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.
+
+[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
+- add .conf file
+  - Search criteria
+  - allow/disable emails and alter addresses / content
+  - allow/disable the Google API feature
+- Add auto created GIS link to be stored in mysql database
+- Allow results.py to take command line arguments to adjust output
+  - Show results from within X days
+  - Show results within X price range
+  - Show results with/without house on property
+  - Show results within X time/dist to school/work
+  - Show various columns in output
+  - Output results to csv.

+ 8 - 4
index.py

@@ -169,6 +169,7 @@ class MLSDATA:
         ba = bedbath[1][:-3]
         baths = ba							## IF House is present
         bedrooms = br							## IF House is present
+        address = ''
         for element in details:
           if 'sqft' in element.getText():
             sqft = element.findAll('td')[1].getText().strip()[:-5].replace(',','')
@@ -185,10 +186,12 @@ class MLSDATA:
             else:
               type = 'unknown'
           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','')
         data = Property(site_name = self.mlstype,  \
 		type = type, \
@@ -381,6 +384,7 @@ if __name__ == '__main__':
 
   #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)