I am trying to make a number of GET requests (between 1000 and 2000) to an API. So far it takes more than 5 mins and the MySQL server just closes my connection.
I am trying to make it in less than a minute. It should be possible ?
Here is what I have so far:
def get_data(devices):
for dev in devices: #array containing around 1000 devices
model = str(dev[0])
brand = str(dev[1])
model = model.replace(" ", "%20")
brand = brand.replace(" ","%20")
os = urllib2.urlopen('https://api.com/getData?&brand=' + brand + '&model='+ model).read()
xmldoc = minidom.parseString(os)
for element in xmldoc.getElementsByTagName('name'):
print (element.firstChild.nodeValue)