Forums

requests.get works in script but not in web app

I have a web app view that uses requests.get with google api to retrieve some posts from my google blogger blog. The requests.get never completes. Yet in contrast, if I run the view as a script instead, using the same virtualenv, the requests.get do run and the script completes.

I'm a newb and don't know what other log information to look for aside from the below. But maybe I'm missing something obvious here? I've been told that googleapis is already whitelisted. (https://www.googleapis.com/blogger/)

The server error log says: ERROR - 2018-09-19 21:41:38,316 - DEBUG - Starting new HTTPS connection (1): www.googleapis.com:4432018-09-19 21:41:38,319 - ERROR - 2018-09-19 21:41:38,316 - DEBUG - Starting new HTTPS connection (1): www.googleapis.com:443--- Logging error ---2018-09-19 21:41:38,321 - ERROR - 2018-09-19 21:41:38,316 - DEBUG - Starting new HTTPS connection (1): www.googleapis.com:4432018-09-19 21:41:38,319 - ERROR - 2018-09-19 21:41:38,316

That is odd -- if it works from a console, it should work in your website's code too.

Those --- Logging error --- messages are interesting; I wonder if some kind of logging issue is hiding the error messages that we need to debug the issue. Which web framework are you using? Do you have any custom logging config?

Wow, Giles, you were spot on. Thank you. I suppressed my logging code, expecting this would help me debug, but what actuallly happened after removing the logging code is that my website now works.

Excellent! Glad I could help :-)