2👍
✅
Python functions that don’t explicitly return
anything will return None
. If this code is returning None
on your production server, it’s probably because it’s hitting that last except: pass
block, as you mentioned.
Without reading the actual code (which I haven’t), I’d say replace that pass
with return ''
to safely swallow the urlfetch.Error
or decide what you want to happen in that case and implement some new code for that block.
Source:stackexchange.com