@contextlib.contextmanager
def _httplib2_debug_level(http_request, level, http=None):
 if (http_request.loggable_body is None):
  (yield)
  return
 old_level = httplib2.debuglevel
 http_levels = {}
 httplib2.debuglevel = level
 if ((http is not None) and (getattr(http, 'connections', None) is not None)):
  for (connection_key, connection) in http.connections.items():
   if (':' not in connection_key):
    continue
   http_levels[connection_key] = connection.debuglevel
   connection.set_debuglevel(level)
 (yield)
 httplib2.debuglevel = old_level
 if (http is not None):
  for (connection_key, old_level) in http_levels.items():
   http.connections[connection_key].set_debuglevel(old_level)

@ contextlib . contextmanager def _httplib2_debug_level ( http_request , level , http = None ) : if ( http_request . loggable_body is None ) : ( yield ) return old_level = httplib2 . debuglevel http_levels = { } httplib2 . debuglevel = level if ( ( http is not None ) and ( getattr ( http , 'connections' , None ) is not None ) ) : for ( connection_key , connection ) in http . connections . items ( ) : if ( ':' not in connection_key ) : continue http_levels [ connection_key ] = connection . debuglevel connection . set_debuglevel ( level ) ( yield ) httplib2 . debuglevel = old_level if ( http is not None ) : for ( connection_key , old_level ) in http_levels . items ( ) : http . connections [ connection_key ] . set_debuglevel ( old_level )
temporarily change the value of httplib2 .