Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-13 Thread Lie Ryan
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() I was about that suggest that actually, just be careful to escape things properly.

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-13 Thread Roy Smith
In article mailman.15778.1415890500.18130.python-l...@python.org, Lie Ryan lie.1...@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())

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-12 Thread Larry Martell
On Tue, Nov 11, 2014 at 10:48 AM, Larry Martell larry.mart...@gmail.com wrote: I have a PHP app that I want to convert to django. But I want to do it stages. All the heavy lifting is in the PHP code, so first, I want to just use templates and views to generate the HTML, but still call the PHP

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-12 Thread Michael Torrie
On 11/11/2014 10:30 AM, Larry Martell wrote: They are technically savvy. They are a 100% PHP shop. They have a big, complicated app that they've been working on for 10 years. No one there knows python or django. They want to put some new frontends on their app. I was bought in for another

Converting a PHP app to Python + Django (was: Communicating with a PHP script (and pretending I'm a browser))

2014-11-12 Thread Ben Finney
Michael Torrie torr...@gmail.com writes: If the shop is entire a PHP shop, and no one knows python, then rewriting things in Python and Django is a really bad idea. It can be done well; see “Transitioning from PHP to Django on the sly”

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-12 Thread Marko Rauhamaa
Michael Torrie torr...@gmail.com: I've worked in shops before where one person comes in with a new language, writes some code, then leaves, leaving us stranded as it were. Programming languages come and go. If you can handle a Philips screwdriver, you should be able to learn the use of a Torq

Re: Converting a PHP app to Python + Django (was: Communicating with a PHP script (and pretending I'm a browser))

2014-11-12 Thread Larry Martell
On Wed, Nov 12, 2014 at 12:54 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Michael Torrie torr...@gmail.com writes: If the shop is entire a PHP shop, and no one knows python, then rewriting things in Python and Django is a really bad idea. It can be done well; see “Transitioning from PHP

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-12 Thread Michael Torrie
On 11/12/2014 11:37 AM, Marko Rauhamaa wrote: Michael Torrie torr...@gmail.com: I've worked in shops before where one person comes in with a new language, writes some code, then leaves, leaving us stranded as it were. Programming languages come and go. If you can handle a Philips

Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
I have a PHP app that I want to convert to django. But I want to do it stages. All the heavy lifting is in the PHP code, so first, I want to just use templates and views to generate the HTML, but still call the PHP code. Then later convert the PHP to python. My issue is that the PHP code expects

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Chris Angelico
On Wed, Nov 12, 2014 at 2:48 AM, Larry Martell larry.mart...@gmail.com wrote: Is there some way python can communicate like curl ... it needs to send the request string in the body of a POST request to the URL that will route to the PHP script and get the output back. That is possible, but

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Marc Aymerich
On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell larry.mart...@gmail.com wrote: I have a PHP app that I want to convert to django. But I want to do it stages. All the heavy lifting is in the PHP code, so first, I want to just use templates and views to generate the HTML, but still call the PHP

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 10:54 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 12, 2014 at 2:48 AM, Larry Martell larry.mart...@gmail.com wrote: Is there some way python can communicate like curl ... it needs to send the request string in the body of a POST request to the URL that will

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell larry.mart...@gmail.com wrote: I have a PHP app that I want to convert to django. But I want to do it stages. All the heavy lifting is in the PHP code, so first, I want

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Joel Goldstick
On Tue, Nov 11, 2014 at 11:37 AM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 10:54 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 12, 2014 at 2:48 AM, Larry Martell larry.mart...@gmail.com wrote: Is there some way python can communicate like curl ... it needs

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Marc Aymerich
On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell larry.mart...@gmail.com wrote: I have a PHP app that I want to convert to django. But I want

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 12:18 PM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 11:43 AM, Joel Goldstick joel.goldst...@gmail.com wrote: On Tue, Nov 11, 2014 at 11:37 AM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 10:54 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 12, 2014 at 2:48 AM, Larry Martell

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Marc Aymerich
On Tue, Nov 11, 2014 at 6:26 PM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 12:18 PM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 12:31 PM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 6:26 PM, Larry Martell larry.mart...@gmail.com wrote: On Tue, Nov 11, 2014 at 12:18 PM, Marc Aymerich glicer...@gmail.com wrote: On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Denis McMahon
On Tue, 11 Nov 2014 10:48:41 -0500, Larry Martell wrote: Is there some way python can communicate like curl ... it needs to send the request string in the body of a POST request to the URL that will route to the PHP script and get the output back. http://www.lmgtfy.com/?q=python+http+request

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Ethan Furman
On 11/11/2014 09:30 AM, Larry Martell wrote: They are technically savvy. They are a 100% PHP shop. They have a big, complicated app that they've been working on for 10 years. No one there knows python or django. They want to put some new frontends on their app. I was bought in for another

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Joel Goldstick
On Tue, Nov 11, 2014 at 12:55 PM, Ethan Furman et...@stoneleaf.us wrote: On 11/11/2014 09:30 AM, Larry Martell wrote: They are technically savvy. They are a 100% PHP shop. They have a big, complicated app that they've been working on for 10 years. No one there knows python or django. They

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Chris Angelico
On Wed, Nov 12, 2014 at 4:55 AM, Ethan Furman et...@stoneleaf.us wrote: On 11/11/2014 09:30 AM, Larry Martell wrote: They are technically savvy. They are a 100% PHP shop. They have a big, complicated app that they've been working on for 10 years. No one there knows python or django. They