Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50806
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.06; '"the': 0.07; 'urllib2': 0.07; 'http': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; "'q'": 0.16; 'easier.': 0.16; 'edward': 0.16; 'subject:POST': 0.16; 'urllib': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'input': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; '>': 0.26; 'this:': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'skip:& 60': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'requests': 0.31; 'writes:': 0.31; 'stuff': 0.32; 'url:python': 0.33; '"the': 0.34; 'skip:u 20': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'example,': 0.37; 'skip:& 10': 0.38; 'pm,': 0.38; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'john': 0.61; 'jul': 0.74; 'email addr:panix.com': 0.84; 'to:addr:gordon': 0.84; 'bears': 0.91; 'joel': 0.91; 'url:latest': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iXCnanizrU94nb5CkYS1kfhQOmoUo92a1j0QLnFWC9M=; b=bciUKPg5G6YvAz07Cod7wxQyRVTuwaDVbJL6cAWhYzk19TGtBAhgKc0TeBBFjGv8X3 OVqiYkWCXAICt7k6697sBh0Jg3pNEQ2xTlgn4HVYw6iEK+QDv+OpMFy8VNofoh6k1YCT VQMcrdz4h0H7+1lX7eRRfQGk6miFyaO1Dtk2dMNHTI0V09rrdfX7peh9EaNLYMbAhPAj SgfO1wPVSXsTZ/p0fM4azQ6rmdbTxiQB2bP+a6kB8vZHBjfdtrw7XBgP6wt/AaCtaSJg n8c01UOUnUGYxfJzmvcY34xvj3yqMic9LtuAH3Gcjiw2xjQJykA+sffq4keO0dcZdChG Oz2g== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.236.70 with SMTP id us6mr2706565vec.89.1374092814239; Wed, 17 Jul 2013 13:26:54 -0700 (PDT) |
| In-Reply-To | <ks6u11$gk4$1@reader2.panix.com> |
| References | <00ec2f9b-fcae-428c-8932-163e653dd71b@googlegroups.com> <ks6u11$gk4$1@reader2.panix.com> |
| Date | Wed, 17 Jul 2013 16:26:54 -0400 |
| Subject | Re: Python HTTP POST |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| To | John Gordon <gordon@panix.com> |
| Content-Type | multipart/alternative; boundary=047d7bd6a90614d0c104e1baea91 |
| Cc | "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4814.1374092817.3114.python-list@python.org> (permalink) |
| Lines | 97 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1374092817 news.xs4all.nl 15905 [2001:888:2000:d::a6]:42543 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50806 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Wed, Jul 17, 2013 at 4:15 PM, John Gordon <gordon@panix.com> wrote:
> In <00ec2f9b-fcae-428c-8932-163e653dd71b@googlegroups.com> Matt Graves <
> tunacubes@gmail.com> writes:
>
> > How would I submit a python HTTP POST request to... for example, go to
> > google.com, enter "Pie" into the search box and submit (Search)
>
> Something like this:
>
> import urllib
> import urllib2
>
> # the google form search input box is named 'q'
> data = { 'q': 'Pie' }
>
> response = urllib2.urlopen('http://google.com', urllib.urlencode(data))
> print response.read()
>
> --
> John Gordon A is for Amy, who fell down the stairs
> gordon@panix.com B is for Basil, assaulted by bears
> -- Edward Gorey, "The Gashlycrumb Tinies"
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Many people find urllib and urllib2 to be confusing. There is a module
called requests which makes this stuff a lot easier. ymmv
http://docs.python-requests.org/en/latest/
--
Joel Goldstick
http://joelgoldstick.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python HTTP POST Matt Graves <tunacubes@gmail.com> - 2013-07-17 11:49 -0700
Re: Python HTTP POST John Gordon <gordon@panix.com> - 2013-07-17 20:15 +0000
Re: Python HTTP POST Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-17 16:26 -0400
Re: Python HTTP POST Sivaram Neelakantan <nsivaram.net@gmail.com> - 2013-07-18 23:37 +0530
Re: Python HTTP POST alex23 <wuwei23@gmail.com> - 2013-07-18 12:04 +1000
csiph-web