'Python: request module confirm popup

After POST request, there is confirmation(jquery) box appears in browser.

So How do I select confirmation box using request api ?

Here HTML page :

<div class="sent_sms_bg">
    <form name="smsAction" id="smsAction" action="/sms_all_action" method="post">
    <p><input name="" id="select_all" type="checkbox" value="" /> Select All</p>
    <p><input name="Delete_SMS" type="button" class="delete_selected" value="Delete Selected" />
    </p>
</div>

and What I'm trying :

self.session = requests.session()

..
...
url = 'http://www.indyarocks.com/sms_all_action'

form = {
    'select_all' : 'on',
    'Delete_SMS': 'Delete Selected',
    }

status = self.session.post(url , data = form)


Solution 1:[1]

POSTing directly to the url should work, as presumably the website has a form with an ajax popup to make sure you really want to submit the form, THEN POSTs the data to the URL. It wouldn't work to POST the data first and then fire the popup (as the form is already submitted so it's too late to do anything about it)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jeffknupp