forked from p34709852/monkey
Add timeout for URL queries
This commit is contained in:
parent
627f34f1f2
commit
796ac48c72
|
@ -6,7 +6,7 @@ __author__ = 'itay.mizeretz'
|
||||||
class AWS(object):
|
class AWS(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
try:
|
try:
|
||||||
self.instance_id = urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read()
|
self.instance_id = urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id', timeout=2).read()
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
self.instance_id = None
|
self.instance_id = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue