You can do this by setting height and width in device matrices :
Below is the code in java :
/** It gives chrome driver to run on chrome browser emulator
* @return instance of chromedriver
*/
public static WebDriver getChromeDriverForChromeEmulator() {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver-2.35.exe");
Map<String, Object> deviceMetrics = new HashMap<String, Object>();
deviceMetrics.put("width", 1024); // device width
deviceMetrics.put("height", 768); // device height
deviceMetrics.put("pixelRatio", 2.0);
Map<String, Object> mobileEmulation = new HashMap<String, Object>();
mobileEmulation.put("deviceMetrics", deviceMetrics);
mobileEmulation.put("userAgent",
"Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
return new ChromeDriver(capabilities);
}
It will open the browser in landscape mode.
Hope that helps you and may be you can implement it in your Python Code :)