projects
/
python_utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21612b3
)
Handle census site unavailability w/o throwing.
author
Scott Gasch
<
[email protected]
>
Fri, 29 Apr 2022 18:26:25 +0000
(11:26 -0700)
committer
Scott Gasch
<
[email protected]
>
Fri, 29 Apr 2022 18:26:25 +0000
(11:26 -0700)
geocode.py
patch
|
blob
|
history
diff --git
a/geocode.py
b/geocode.py
index 0a020d5fd79fa0145f3a944dacafcb12f4d0470e..428eb58ccb793f6cf4508aca16b5d4c202a45257 100644
(file)
--- a/
geocode.py
+++ b/
geocode.py
@@
-35,7
+35,12
@@
def geocode_address(address: str) -> Optional[Dict[str, Any]]:
url += '&layers=all&benchmark=4&vintage=4'
url = requote_uri(url)
logger.debug('GET: %s', url)
- r = requests.get(url)
+ try:
+ r = requests.get(url)
+ except Exception as e:
+ logger.exception(e)
+ return None
+
if r.status_code != 200:
logger.error('Unexpected response code %d, wanted 200. Fail.', r.status_code)
return None