def connect(host=None, port=None): """Open a new datafind connection Parameters ---------- host : `str` name of datafind server to query port : `int` port of datafind server on host Returns ------- connection : :class:`~glue.datafind.GWDataFindHTTPConnection` the new open connection """ from glue import datafind port = port and int(port) if port is not None and port != 80: cert, key = datafind.find_credential() return datafind.GWDataFindHTTPSConnection(host=host, port=port, cert_file=cert, key_file=key) return datafind.GWDataFindHTTPConnection(host=host, port=port)
def _query(): if cert is not None: dfconn = datafind.GWDataFindHTTPSConnection( host=host, port=port, cert_file=cert, key_file=key) else: dfconn = datafind.GWDataFindHTTPConnection(host=host, port=port) return dfconn.find_frame_urls(ifo[0].upper(), frametype, gpsstart, gpsend, urltype=urltype, on_gaps=gaps)
def find_frames(site, frametype, gpsstart, gpsend, **kwargs): """Find frames for given site and frametype """ # connect host = kwargs.pop('host', None) port = kwargs.pop('port', None) port = port and int(port) if port is not None and port != 80: cert, key = datafind.find_credential() connection = datafind.GWDataFindHTTPSConnection( host=host, port=port, cert_file=cert, key_file=key) else: connection = datafind.GWDataFindHTTPConnection(host=host, port=port) # find frames kwargs.setdefault('urltype', 'file') return connection.find_frame_urls(site[0], frametype, gpsstart, gpsend, **kwargs)