MechanicalSoup v0.12.0 Release Notes

Release Date: 2019-08-27 // 11 months ago
  • Main changes:

    🔄 Changes in official python version support: added 3.7 and dropped 3.4.

    ⚡️ Added ability to submit a form without updating StatefulBrowser internal state: submit_selected(..., update_state=False). This means you get a response from the form submission, but your browser stays on the same page. Useful for handling forms that result in a file download or open a new tab.

    🐛 Bug fixes

    👌 Improve handling of form enctype to behave like a real browser. [#242]

    HTML type attributes are no longer required to be lowercase. [#245]

    Form controls with the disabled attribute will no longer be submitted to improve compliance with the HTML standard. If you were relying on this bug to submit disabled elements, you can still achieve this by deleting the disabled attribute from the element in the Form object directly. [#248]

    💻 When a form containing a file input field is submitted without choosing a file, an empty filename & content will be sent just like in a real browser. [#250]

    <option> tags without a value attribute will now use their text as the value. [#252]

    The optional url_regex argument to follow_link and download_link was fixed so that it is no longer ignored. [#256]

    👍 Allow duplicate submit elements instead of raising a LinkNotFoundError. [#264]

    🚀 Our thanks to the many new contributors in this release!


Previous changes from v0.11.0

  • 📚 This release focuses on fixing bugs related to uncommon HTTP/HTML scenarios and on improving the documentation.

    🐛 Bug fixes

    🗄 Constructing a Form instance from a bs4.element.Tag whose tag name is not form will now emit a warning, and may be deprecated in the future. [#228]

    💥 Breaking Change: LinkNotFoundError now derives from Exception instead of BaseException. While this will bring the behavior in line with most people's expectations, it may affect the behavior of your code if you were heavily relying on this implementation detail in your exception handling. [#203]

    👌 Improve handling of button submit elements. Will now correctly ignore buttons of type button and reset during form submission, since they are not considered to be submit elements. [#199]

    👷 Do a better job of inferring the content type of a response if the Content-Type header is not provided. [#195]

    👌 Improve consistency of query string construction between MechanicalSoup and web browsers in edge cases where form elements have duplicate name attributes. This prevents errors in valid use cases, and also makes MechanicalSoup more tolerant of invalid HTML. [#158]