<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 17, 2013 at 4:15 PM, John Gordon <span dir="ltr"><<a href="mailto:gordon@panix.com" target="_blank">gordon@panix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">In <<a href="mailto:00ec2f9b-fcae-428c-8932-163e653dd71b@googlegroups.com">00ec2f9b-fcae-428c-8932-163e653dd71b@googlegroups.com</a>> Matt Graves <<a href="mailto:tunacubes@gmail.com">tunacubes@gmail.com</a>> writes:<br>

<br>
> How would I submit a python HTTP POST request to... for example, go to<br>
> <a href="http://google.com" target="_blank">google.com</a>, enter "Pie" into the search box and submit (Search)<br>
<br>
</div>Something like this:<br>
<br>
import urllib<br>
import urllib2<br>
<br>
# the google form search input box is named 'q'<br>
data = { 'q': 'Pie' }<br>
<br>
response = urllib2.urlopen('<a href="http://google.com" target="_blank">http://google.com</a>', urllib.urlencode(data))<br>
print response.read()<br>
<span class=""><font color="#888888"><br>
--<br>
John Gordon                   A is for Amy, who fell down the stairs<br>
<a href="mailto:gordon@panix.com">gordon@panix.com</a>              B is for Basil, assaulted by bears<br>
                                -- Edward Gorey, "The Gashlycrumb Tinies"<br>
<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br></div><div class="gmail_extra">Many people find urllib and urllib2 to be confusing.  There is a module called requests which makes this stuff a lot easier.  ymmv<br><br><a href="http://docs.python-requests.org/en/latest/">http://docs.python-requests.org/en/latest/</a><br clear="all">
</div><div class="gmail_extra"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>