How to make POST request in robobrowser-python

python, python-2.7, python-requests, robobrowser

Solution

You can re-use the `requests.Session()` object of a `RoboBrowser` object to do your own `POST`s with the same cookies:

response = browser.session.post(...)

The `RoboBrowser` state won't be updated though; you'd have to pass the `response` object to the `RoboBrowser._update_state()` method.

browser._update_state(response)

For AJAX requests you wouldn't need to do this, however.

Take into account that future versions of the library may change how that works; it's not a documented method.

However, normally you'd post to a site because you are handling a form submit; leave that to the provided library functionality (`RoboBrowser.get_form()`, then `RoboBrowser.submit_form()`).

Problem

http://robobrowser.readthedocs.org/en/latest/api.html I'm trying to hit an API using `browser.open(myurl)` and looking for a RB method similar to `requests.post(url,data=data)`. since robobrowser built on the top of requests and beautifulsoup so I think there must be a way to do so.

Original source