Explorar el Código

Quick Fix - failure on email float type to string

Miek Stagl hace 5 años
padre
commit
fbbad9d9f2
Se han modificado 5 ficheros con 99 adiciones y 4 borrados
  1. 1 0
      .gitignore
  2. 2 0
      CHANGELOG
  3. 1 1
      index.py
  4. 3 3
      landsearch.conf
  5. 92 0
      landsearch.log

+ 1 - 0
.gitignore

@@ -3,3 +3,4 @@ __pycache__
 *.log
 #*.conf
 .idea/
+test.html

+ 2 - 0
CHANGELOG

@@ -23,6 +23,8 @@ Improved Logging.
 Removed need for user to call connect_db() and close_db() in user code.
 Added live_google to .conf file to allow user to select wether or not to call Google API.
 Applied Update1 - added datestamp to logging output
+Formatted HTML emails
+landearch.conf now holds email addresses for emails
 
 
 FUTURE GOALS

+ 1 - 1
index.py

@@ -456,7 +456,7 @@ class MLSDATA:
                     html += '<tr><th>MLS</th><td>' + listing.MLS + '</td></tr>'
                     html += '<tr><th>Address</th><td>' + listing.address + '</td></tr>'
                     html += '<tr><th>Acres</th><td>' + '{:0,.2f}'.format(float(listing.acres)) + '</td></tr>'
-                    html += '<tr><th>Time To School</th><td>' + (listing.time_to_school/60 if hasattr(listing, 'time_to_school') else 'NA') + '</td></tr>'
+                    html += '<tr><th>Time To School</th><td>' + (str(int(round(listing.time_to_school/60))) if hasattr(listing, 'time_to_school') else 'NA') + '</td></tr>'
                     html += '<tr><th>Price</th><td>' + '${:0,.0f}'.format(int(listing.price)) + '</td></tr>'
                     html += '<tr><th>Link</th><td><a href=' + listing.link + '>Link</a></td></tr>'
                     body = """Daily Real Estate Search Report.\n

+ 3 - 3
landsearch.conf

@@ -4,7 +4,7 @@ county = Hall
 
 ## Accepts farm, house, and/or land.  Seperate multiples with comman.  Default is all 3
 ## land typically refers to land-lots
-type = farm
+; type = farm
 
 ; lower_price = 0
 ; upper_price = 525000
@@ -16,11 +16,11 @@ type = farm
 ; upper_bedrooms = 10
 
 ## It true, sends email of results (whether or not new listings are found)
-email = False
+email = True
 
 ## Live_google will fetch actual time-to-school and time-to-work results from Google API.
 ## There may be a cost for this service, thus it can be turned off for testing.
-live_google = False
+live_google = True
 
 [Logging]
 log_file = landsearch.log

+ 92 - 0
landsearch.log

@@ -481,3 +481,95 @@
 2020-09-24 11:05:01 DEBUG    Scanned: 5260 Britt Whitmire Rd
 2020-09-24 11:05:01 DEBUG    Scanned: 4496 B Clark Rd
 2020-09-24 11:05:02 DEBUG    Scanned: 3792 Tanners Mill Rd
+2020-09-24 11:11:23 DEBUG    Log level set to 10
+2020-09-24 11:11:23 DEBUG    {'types': ['land', 'farm', 'home', 'house'], 'county': ['Hall'], 'lower_price': '0', 'upper_price': '525000', 'lower_acres': '5', 'upper_acres': '15', 'type': ['farm', 'house', 'land'], 'lower_sqft': '', 'upper_sqft': '', 'lower_bedrooms': '', 'upper_bedrooms': ''}
+2020-09-24 11:11:23 DEBUG    Log level set to 10
+2020-09-24 11:11:23 DEBUG    {'types': ['land', 'farm', 'home', 'house'], 'county': ['Hall'], 'lower_price': '0', 'upper_price': '525000', 'lower_acres': '5', 'upper_acres': '15', 'type': ['farm', 'house', 'land'], 'lower_sqft': '', 'upper_sqft': '', 'lower_bedrooms': '', 'upper_bedrooms': ''}
+2020-09-24 11:11:23 INFO     getgmlsdata starting.
+2020-09-24 11:11:23 DEBUG    Scanning: Hall county
+2020-09-24 11:11:23 DEBUG    https://www.georgiamls.com/real-estate/search-action.cfm?cnty=Hall&lpl=0&lph=525000&acresL=5&acresH=15&sqftl=&sqfth=&orderBy=b&scat=1&sdsp=g&typ=af&typ=sd&typ=ll
+2020-09-24 11:11:24 DEBUG    Scanned: 3995 Falcon Pkwy
+2020-09-24 11:11:24 DEBUG    Scanned: 5461 Thompson Mill Rd
+2020-09-24 11:11:24 DEBUG    Scanned: 3196 Joe Parker Rd
+2020-09-24 11:11:24 DEBUG    Scanned: 6277 Lights Ferry Rd
+2020-09-24 11:11:25 DEBUG    Scanned: 3780 Hardy Rd
+2020-09-24 11:11:25 DEBUG    Scanned: 3533 Mcever Rd
+2020-09-24 11:11:25 DEBUG    Scanned: 3814 Bolding Rd
+2020-09-24 11:11:25 DEBUG    Scanned: 5555 Wg Robinson Rd
+2020-09-24 11:11:26 DEBUG    Scanned: 4422 Autry Rd
+2020-09-24 11:11:26 DEBUG    Scanned: 4768 Highland Cir
+2020-09-24 11:11:26 DEBUG    Scanned: 9373 Callus Mill Rd
+2020-09-24 11:11:26 DEBUG    Scanned: 3461 Thompson Bridge
+2020-09-24 11:11:27 DEBUG    Scanned: 5776 Conner Rd
+2020-09-24 11:11:27 DEBUG    Scanned: 2967 Beards Rd
+2020-09-24 11:11:27 DEBUG    Scanned: 5260 Britt Whitmire Rd
+2020-09-24 11:11:28 DEBUG    Scanned: 5375 Price Rd
+2020-09-24 11:11:28 DEBUG    Scanned: 4496 B Clark Rd
+2020-09-24 11:11:28 DEBUG    Scanned: 4730 Clarks Bridge rd
+2020-09-24 11:11:28 DEBUG    Scanned: 6055 Walden Rd Unit: Lot 2
+2020-09-24 11:11:29 DEBUG    Scanned: 4857 Holiday Villa Dr
+2020-09-24 11:11:29 DEBUG    Scanned: 3792 Tanners Mill Rd
+2020-09-24 11:11:29 DEBUG    Scanned: 3323 Duckett Mill Rd
+2020-09-24 11:11:29 DEBUG    Scanned: 5960 Cornelia Highway
+2020-09-24 11:11:30 DEBUG    Scanned: 3122 Old Cornelia Hwy
+2020-09-24 11:11:30 DEBUG    Scanned: 5715 Oscar Gilstrap Rd
+2020-09-24 11:11:30 DEBUG    Scanned: 5315 Elrod Rd
+2020-09-24 11:11:31 DEBUG    Scanned: 3549 Martin Creek Dr
+2020-09-24 11:11:31 DEBUG    Scanned: 0 Old Cornelia Highway
+2020-09-24 11:11:31 DEBUG    Scanned: 3545 Martin Creek Dr
+2020-09-24 11:11:31 DEBUG    Scanned: 4995 Forest Dr
+2020-09-24 11:11:31 INFO     Completed search in Hall county. 30 total properties scanned.
+2020-09-24 11:11:31 DEBUG    No Database Connection.  Connecting to DB in check_db function.
+2020-09-24 11:11:31 WARNING  Calling Google API. $$
+2020-09-24 11:11:32 INFO     Inserted 8696779 | 5461 Thompson Mill Rd into database.
+2020-09-24 11:11:32 WARNING  Calling Google API. $$
+2020-09-24 11:11:32 INFO     Inserted 8862271 | 4768 Highland Cir into database.
+2020-09-24 11:11:32 INFO     Database Update Complete.
+2020-09-24 11:11:32 INFO     2 new listings found.
+2020-09-24 11:11:34 INFO     Emails sent to: ['M_Stagl@hotmail.com', ' stagl.mike@gmail.com']
+2020-09-24 11:13:45 DEBUG    Log level set to 10
+2020-09-24 11:13:45 DEBUG    {'types': ['land', 'farm', 'home', 'house'], 'county': ['Hall'], 'lower_price': '0', 'upper_price': '525000', 'lower_acres': '5', 'upper_acres': '15', 'type': ['farm', 'house', 'land'], 'lower_sqft': '', 'upper_sqft': '', 'lower_bedrooms': '', 'upper_bedrooms': ''}
+2020-09-24 11:13:45 DEBUG    Log level set to 10
+2020-09-24 11:13:45 DEBUG    {'types': ['land', 'farm', 'home', 'house'], 'county': ['Hall'], 'lower_price': '0', 'upper_price': '525000', 'lower_acres': '5', 'upper_acres': '15', 'type': ['farm', 'house', 'land'], 'lower_sqft': '', 'upper_sqft': '', 'lower_bedrooms': '', 'upper_bedrooms': ''}
+2020-09-24 11:13:45 INFO     getgmlsdata starting.
+2020-09-24 11:13:45 DEBUG    Scanning: Hall county
+2020-09-24 11:13:45 DEBUG    https://www.georgiamls.com/real-estate/search-action.cfm?cnty=Hall&lpl=0&lph=525000&acresL=5&acresH=15&sqftl=&sqfth=&orderBy=b&scat=1&sdsp=g&typ=af&typ=sd&typ=ll
+2020-09-24 11:13:45 DEBUG    Scanned: 3995 Falcon Pkwy
+2020-09-24 11:13:46 DEBUG    Scanned: 5461 Thompson Mill Rd
+2020-09-24 11:13:46 DEBUG    Scanned: 3196 Joe Parker Rd
+2020-09-24 11:13:46 DEBUG    Scanned: 6277 Lights Ferry Rd
+2020-09-24 11:13:47 DEBUG    Scanned: 3780 Hardy Rd
+2020-09-24 11:13:47 DEBUG    Scanned: 3533 Mcever Rd
+2020-09-24 11:13:47 DEBUG    Scanned: 3814 Bolding Rd
+2020-09-24 11:13:47 DEBUG    Scanned: 5555 Wg Robinson Rd
+2020-09-24 11:13:48 DEBUG    Scanned: 4422 Autry Rd
+2020-09-24 11:13:48 DEBUG    Scanned: 4768 Highland Cir
+2020-09-24 11:13:48 DEBUG    Scanned: 9373 Callus Mill Rd
+2020-09-24 11:13:48 DEBUG    Scanned: 3461 Thompson Bridge
+2020-09-24 11:13:49 DEBUG    Scanned: 5776 Conner Rd
+2020-09-24 11:13:49 DEBUG    Scanned: 2967 Beards Rd
+2020-09-24 11:13:49 DEBUG    Scanned: 5260 Britt Whitmire Rd
+2020-09-24 11:13:49 DEBUG    Scanned: 5375 Price Rd
+2020-09-24 11:13:50 DEBUG    Scanned: 4496 B Clark Rd
+2020-09-24 11:13:50 DEBUG    Scanned: 4730 Clarks Bridge rd
+2020-09-24 11:13:50 DEBUG    Scanned: 6055 Walden Rd Unit: Lot 2
+2020-09-24 11:13:50 DEBUG    Scanned: 4857 Holiday Villa Dr
+2020-09-24 11:13:51 DEBUG    Scanned: 3792 Tanners Mill Rd
+2020-09-24 11:13:51 DEBUG    Scanned: 3323 Duckett Mill Rd
+2020-09-24 11:13:51 DEBUG    Scanned: 5960 Cornelia Highway
+2020-09-24 11:13:51 DEBUG    Scanned: 3122 Old Cornelia Hwy
+2020-09-24 11:13:52 DEBUG    Scanned: 5715 Oscar Gilstrap Rd
+2020-09-24 11:13:52 DEBUG    Scanned: 5315 Elrod Rd
+2020-09-24 11:13:52 DEBUG    Scanned: 3549 Martin Creek Dr
+2020-09-24 11:13:52 DEBUG    Scanned: 0 Old Cornelia Highway
+2020-09-24 11:13:53 DEBUG    Scanned: 3545 Martin Creek Dr
+2020-09-24 11:13:53 DEBUG    Scanned: 4995 Forest Dr
+2020-09-24 11:13:53 INFO     Completed search in Hall county. 30 total properties scanned.
+2020-09-24 11:13:53 DEBUG    No Database Connection.  Connecting to DB in check_db function.
+2020-09-24 11:13:53 WARNING  Calling Google API. $$
+2020-09-24 11:13:53 INFO     Inserted 8696779 | 5461 Thompson Mill Rd into database.
+2020-09-24 11:13:53 WARNING  Calling Google API. $$
+2020-09-24 11:13:54 INFO     Inserted 8862271 | 4768 Highland Cir into database.
+2020-09-24 11:13:54 INFO     Database Update Complete.
+2020-09-24 11:13:54 INFO     2 new listings found.
+2020-09-24 11:13:55 INFO     Emails sent to: ['M_Stagl@hotmail.com', ' stagl.mike@gmail.com']