How to use view_center_camera for fitting camera to 3D view?
This code works in 2.80:
import bpy

def find_3d_area():
    for area in bpy.context.window.screen.areas:
        if area.type == 'VIEW_3D':
            return area

area = find_3d_area()
if area:
    override = {
        'area': area,
        'region': area.regions[0],
    }
    if bpy.ops.view3d.view_center_camera.poll(override):
        bpy.ops.view3d.view_center_camera(override)

Blender operators have optional parameter &quot;context&quot;. In almost all cases, you don't need to override it, but this case is somewhat special.
In this case, you have to override area and region. I'm not able to explain into the deep why exactly these two keys are needed. It's only the result of my debugging inside C code of Blender, and trial/error in Python.