forked from MechanicalSoup/MechanicalSoup
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect user-specified enctype in forms
Fixes MechanicalSoup#242. Make MechanicalSoup behave as a real browser: - only "multipart/form-data" enctype allow file sending - forms without file inputs can now be sent as "multipart/form-data" if specified. - "application/x-www-form-urlencoded" is the default when enctype is wrong or not specified The added code uses a hack because of a lack in Requests functionalities: Requests doesn't support forcing enctype yet, and doesn't allow to submit using "multipart/data-form" enctype without submitting files. So the best way we found to bypass this is to pass an modified dict as files to Requests. This code could change in the future if Requests implements a "force enctype" feature.
- Loading branch information
Showing
2 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters