I am writing a function for some existing python code that will be passed a Mechanize browser object as a parameter.
I fill in some details in a form in the browser, and
I'm assuming that you want the submission to happen even if it takes multiple tries.
The solution that I thought of is certainly not efficient, but it should work.
def do_something_in_mechanize():
<...insert your code here...>
try:
browser.submit()
<...rest of your code...>
except mechanize.HTTPError:
do_something_in_mechanize()
Basically, it'll call the function until the action is performed without HTTPError
s.