I do not have much experience with shell or python scripts so I am looking for some help on how I can accomplish this.
Goal:
Pass arguments to a shell or python script file that will be used to perform either a cURL Post request or a python post request.
Let's say I go the python route and the filename is api.py
import json,httplib
connection = httplib.HTTPSConnection('api.example.com', 443)
connection.connect()
connection.request('POST', '/message', json.dumps({
"where": {
"devicePlatform": "andriod"
},
"data": {
"body": "Test message!",
"subject": "Test subject"
}
}), {
"X-Application-Id": "XXXXXXXXX",
"X-API-Key": "XXXXXXXX",
"Content-Type": "application/json"
})
result = json.loads(connection.getresponse().read())
print result
How would I go about passing in arguments to for the body and subject values and how would that look via command line?
Thanks