(Mar-14-2017, 10:05 AM)c0da Wrote: Hello all,
I'm new to Python and try to find out how useful it is for web programming.
I searched the web, but I couldn't find an answer to how to send data from my browser to
my Python program on the server, without using frameworks.
Is there an eqiuvalent to the php GET and POST commands?
How do I send the input, generated by a HTML form to a Python Program on my server?
Thank you!
GET/POST are faily high level commands. In Python see the
requests
module (non-standard, but very popular). Otherwise use the urllib
or urllib2
modules.Typical use of
requests
:import json,requests headers={'Content-type':'application/json'} auth=('someid', 'somepwd') parameters={"foo":"bar"} // as a python dictionary url="http://someserver/somerequest/" req=requests.post(url,auth=auth,headers=headers,data=json.dumps(parameters)) jsonresponse=req.json()
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net