Skip to content

Commit f6913bb

Browse files
US zipcode lookup may fail (#13)
I think this happens with Guam, that the zipcode isn't in the database.
1 parent 7382c50 commit f6913bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/salesforce_entry.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ def populate_via_zipcode(self, zipcode_search_engine: SearchEngine) -> None:
115115
if self.country != "USA" or not self.zipcode or (self.state and self.city):
116116
return
117117
zipcode_info = zipcode_search_engine.by_zipcode(self.zipcode)
118-
self.state = zipcode_info.state
119-
self.city = zipcode_info.major_city
118+
if zipcode_info:
119+
self.state = zipcode_info.state
120+
self.city = zipcode_info.major_city
120121

121122
def populate_metro_area(
122123
self,

0 commit comments

Comments
 (0)