Python INFO:py4j.java_gateway:Received command c on object id p0

I keep getting “Received command c on object id p0” when executing my Python program. Going through the steps everything fall in place. I had enabled logging to figured out what happened.





INFO:py4j.java_gateway:Received command c on object id p0
INFO:py4j.java_gateway:Received command c on object id p0
INFO:py4j.java_gateway:Received command c on object id p0
...

I enabled logging when doing a requests. Notes the logging level in this example

import requests
import logging

import http.client as http_client

http_client.HTTPConnection.debuglevel = 1

logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True

requests.get('https://httpbin.org/headers')

Hopefully you have notes that the logging has been set to Debug. The outcome would also come for INFO level. As the documentation states the default is ERROR https://docs.python.org/3/library/logging.html#logging.Logger.setLevel

But since we have set it to a higher level we will get way more output.

So avoid all the logging and only received on error you have to set the logging level to ERROR

requests_log.setLevel(logging.ERROR)

Following up from: https://spacetech.dk/python-how-to-enable-http-requests-debug-output.html