Since I do my first steps in Python, I try to figure out, how can I do a simple URL call in Python with key=value pairs like:
http://somehost/somecontroller/action?key1=value1&key2=value2
I tried with some things like:
key1 = 'value'
key2 = 10
requests.get("http://somehost/somecontroller/action?key1=" + value + "&key2=" + str(10))
or
data={'key1': 'value', 'key2': str(10)}
requests.get("http://somehost/somecontroller/action", params=data)
(from here)
But this don't work. I also tried it by calling curl
with subprocess.Popen()
on different ways, but uhm...
I don't want to check the request, the URL call will be enough.