I have been using the below logic and working for me in Java, you can easily port this to python.
FirefoxProfile profile = new FirefoxProfile();
// set the download folder directory
profile.setPreference("browser.download.dir", this.getDownloadFolderPath());
// the last folder specified for a download
profile.setPreference("browser.download.folderList", 2);
// hide Download Manager window when a download begins
profile.setPreference("browser.download.manager.showWhenStarting", false);
/**
This is the most important setting that will make sure the pdf is downloaded
without any prompt
*/
profile.setPreference("pdfjs.disabled", true);
profile.setPreference("pref.downloads.disable_button.edit_actions", false);
profile.setPreference("media.navigator.permission.disabled", true);
// A comma-separated list of MIME types to save to disk without asking what to
// use to open the file.
profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"application/pdf,application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/zip,text/csv,text/plain,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;octet/stream");
// A comma-separated list of MIME types to open directly without asking for
// confirmation.
profile.setPreference("browser.helperApps.neverAsk.openFile",
"application/pdf,application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/zip,text/csv,text/plain,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;octet/stream");
// Do not ask what to do with an unknown MIME type
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
// Leave the window in the background when starting a download (Default Setting
// is false)
profile.setPreference("browser.download.manager.focusWhenStarting", false);
// popup window at bottom right corner of the screen will not appear once all
// downloads are finished.
profile.setPreference("browser.download.manager.showAlertOnComplete", true);
// Close the Download Manager when all downloads are complete
profile.setPreference("browser.download.manager.closeWhenDone", true);
FirefoxOptions options = new FirefoxOptions();
options.setProfile(profile);
Make sure to consume the options
while creating the driver instance.
And let me know if you are still facing the issue.