def postLoadItemUpdate(itemid):
r = requests.post("http://www.domain.com/ex/s/API/r/postLoadItemUpdate?id='".itemid."'")
print(r.text)
what is wrong with '".itemid."'"
There seems to be an syntax error there.
In Python use + operator for string concatenation:
"http://www.domain.com/ex/s/API/r/postLoadItemUpdate?id='" + itemid + "'"
But for string concatenation itemid should be a string object, otherwise you need to use str(itemid).
Another alternative is to use string formatting, here type conversion is not required:
"http://www.domain.com/ex/s/API/r/postLoadItemUpdate?id='{}'".format(itemid)
Where to start: does "constant string".itemid."constant string 2" work in Python?
You need to concatenate strings differently. Interactive mode for Python is your friend: learn to love it:
$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> foo = "-itemid-"
>>> "string1" + foo + "string2"
'string1-itemid-string2'
That should give you a starting point.
Alternatively, you could also use format:
r = requests.post("http://www.domain.com/ex/s/API/r/postLoadItemUpdate?id={0}".format(itemid))
In your particular use case, formal seems to be more flexible, and url changes will have little impact.