Can I get my copy of Mechanize.Browser to stay on the same page after calling b.form.submit ()?

In the Mechanize.Browser Python module, when a form is submitted, the browser instance goes to this page. For this single request, I do not want this; I want it to just stay on the page it is currently on, and give me the answer in another object (for loops). Does anyone know a quick way to do this?

EDIT: Hmm, so I have this kind of work with ClientForm.HTMLForm.click () that returns urllib2 request, but I need cookies to mechanize cookies that will be used in my urllib2.urlopen request. Is there a mechanization way that allows me to send a request in the same way as urllib2, except that cookies will be imported?

+3
source share
1 answer

The answer to my next question in the title is yes, p mechanize.Browser.open_novisit(). It works the same way open(), but it does not change the state of the browser instance, that is, it will retrieve the page, and your browser object will remain where it was.

+7
source

Source: https://habr.com/ru/post/1730314/


All Articles