disable render of all collections with python in blender 2.8
With recursion

As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.

This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection

import bpy

def traverse_tree(t):
    yield t
    for child in t.children:
        yield from traverse_tree(child)

coll = bpy.context.view_layer.layer_collection.collection

for c in traverse_tree(coll):
    c.hide_render = True