Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80699
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!roy |
|---|---|
| From | Roy Smith <roy@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Communicating with a PHP script (and pretending I'm a browser) |
| Date | Thu, 13 Nov 2014 14:41:46 -0500 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 14 |
| Message-ID | <roy-972F3A.14411613112014@news.panix.com> (permalink) |
| References | <CACwCsY46yYFQwdYdriTSYSvLYF=xs6L2zanN9gofkWkoHvj_fA@mail.gmail.com> <CACwCsY4WYsN4=Vq2WmG895SwToMdfUAJhLqXaQ_02zzaAMzsTw@mail.gmail.com> <mailman.15778.1415890500.18130.python-list@python.org> |
| NNTP-Posting-Host | localhost |
| X-Trace | reader1.panix.com 1415907706 17456 127.0.0.1 (13 Nov 2014 19:41:46 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Thu, 13 Nov 2014 19:41:46 +0000 (UTC) |
| User-Agent | MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
| Xref | csiph.com comp.lang.python:80699 |
Show key headers only | View raw
In article <mailman.15778.1415890500.18130.python-list@python.org>,
Lie Ryan <lie.1296@gmail.com> wrote:
> On 13/11/14 03:57, Larry Martell wrote:
> > We were all making this much harder than it is. I ended up doing this:
> >
> > wp = urllib.request.urlopen('http://php_page/?' + request.POST.urlencode())
> > pw = wp.read()
You can do this if you want, but it's much easier to use requests
library (http://docs.python-requests.org/). Compared to using the raw
urllib stuff, requests makes it trivial to deal with argument encoding,
cookie management, and a zillion other little details which will drive
you crazy if you try to roll your own with urllib.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Communicating with a PHP script (and pretending I'm a browser) Lie Ryan <lie.1296@gmail.com> - 2014-11-14 01:54 +1100 Re: Communicating with a PHP script (and pretending I'm a browser) Roy Smith <roy@panix.com> - 2014-11-13 14:41 -0500
csiph-web