How to fit multiple independent slopes and intercepts with the GLM module?

I would get the design matrix using patsy: https://patsy.readthedocs.io/en/latest/API-reference.html#patsy.dmatrix (which GLM does internally), and look at the the rows for group1 and group2.
If I remember correctly, the design matrix from patsy is additive, which means you have:

group1_intercept = intercept
group2_intercept = intercept + group_beta
group1_slope = slope_beta
group2_slope = slope_beta + group_slope_interaction_beta