Hello PyLovers,
I was trying to pass each line of the file as a value to the data. I am just pasting that part of the file. Please advise.
[line refers each line and that is the value that should be passed in the payload.
I was trying to pass each line of the file as a value to the data. I am just pasting that part of the file. Please advise.
[line refers each line and that is the value that should be passed in the payload.
def interfaces(): f = open ('interfaces', 'w') with open("uniquenames") as myfile: for line in myfile: print line payload = "{\"data\": {\"Attributes\": [\"name\", \"speed\", \"status__name\"], \"Filters\": {\"device__name\":\" "line" \" }, \"Type\": \"DevicePort\", \"page_size\": 2}}" headers = {"Content-Type": "application/json"} request = urllib2.Request(url, payload, headers) response = urllib2.urlopen(request) d = response.read() print d