Thanks Leo. That’s a good idea. I’m still coming up to speed on python, but the exception that gets raised seems to vary between OS (Debian versus OSX). Debian throws this:
Traceback (most recent call last):
File “./test.py”, line 23, in
events = client.getEvents(min_datetime=t1,max_datetime=t2,format=‘catalog’)
File “/home/stach/local/src/obspy-dev/obspy/neries/client.py”, line 81, in wrapper
v = f(*args, **new_kwargs)
File “/home/stach/local/src/obspy-dev/obspy/neries/client.py”, line 279, in getEvents
data = self._fetch("/services/event/search", **kwargs)
File “/home/stach/local/src/obspy-dev/obspy/neries/client.py”, line 160, in _fetch
response = urllib2.urlopen(remoteaddr, timeout=self.timeout)
File “/usr/lib/python2.7/urllib2.py”, line 127, in urlopen
return _opener.open(url, data, timeout)
File “/usr/lib/python2.7/urllib2.py”, line 401, in open
response = self._open(req, data)
File “/usr/lib/python2.7/urllib2.py”, line 419, in _open
‘_open’, req)
File “/usr/lib/python2.7/urllib2.py”, line 379, in _call_chain
result = func(*args)
File “/usr/lib/python2.7/urllib2.py”, line 1211, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “/usr/lib/python2.7/urllib2.py”, line 1184, in do_open
r = h.getresponse(buffering=True)
File “/usr/lib/python2.7/httplib.py”, line 1034, in getresponse
response.begin()
File “/usr/lib/python2.7/httplib.py”, line 407, in begin
version, status, reason = self._read_status()
File “/usr/lib/python2.7/httplib.py”, line 365, in _read_status
line = self.fp.readline()
File “/usr/lib/python2.7/socket.py”, line 447, in readline
data = self._sock.recv(self._rbufsize)
socket.timeout: timed out
I was hoping there would be a more data-driven solution than the infinite while loop that tries to pull events. With this method, the “near real-time” granularity is determined by how often the pull requests are made (how small interval is).
Thanks for your help!
josh