from reportlab.lib.pagesizes import letter, A4
lWidth, lHeight = letter
if orientation == 'landscape':
    canvas.setPageSize((lHeight, lWidth))
Reportlab : How to switch between portrait and landscape?