Notice: Undefined index: sfsi_original_counts in /home/thomascojx/www/blog/wp-content/plugins/ultimate-social-media-icons/libs/controllers/sfsiocns_OnPosts.php on line 45
By default when using the excellent requests package, there is not much on the screen to figure out was goes wrong with a specific URL requests. In general, you do not need it but from time to time it is useful to switch the logging level to e.g. DEBUG mode.
r = requests.post(YOUR_URL)
prints nothing on the screen. Now, what about some detais ? Since there is a logging system, let use get it:
This returns nothing special except a root logger. So the logging is actually happening outside of requests.
After some googling, I figured out that this is actcually happenning at a lower level (urllib).
log = logging.getLogger('urllib3')
# logging from urllib3 to console
stream = logging.StreamHandler()
This is now better since you have the url printed to the screen but this is not very helpful.
You need to set an extra debug level in the http package itself:
from http.client import HTTPConnection
HTTPConnection.debuglevel = 1
Now we get much more valuable information about the header, send and reply contents.