data = ['HTTP/1.1 200 OK', 'CACHE-CONTROL: max-age=1810', 'DATE: Wed, 14 May 2014 12:15:19 GMT', 'EXT:', 'LOCATION: http://192.168.94.57:9000/DeviceDescription.xml', 'SERVER: Windows NT/5.0, UPnP/1.0, pvConnect UPnP SDK/1.0', 'ST: uuid:7076436f-6e65-1063-8074-78542e239ff5', 'USN: uuid:7076436f-6e65-1063-8074-78542e239ff5', 'Content-Length: 0', '', '']
From the above list, I have to extract the .xml
link.
My code:
for element in data:
if 'LOCATION' in element:
xmllink = element.split(': ').[1]
It's taking too much time. How can I make this faster?
Actually I am doing SSDP discovery for finding devices in a network. After sending the M-SEARCH command, devices send a datagram packet which I have taken in a data
variable. From this I have to extract the file link of that device for processing it.
When I use indexing to extract, it was done quickly.