dqsegdb2

raw JSON →
1.3.0 verified Fri May 01 auth: no python maintenance

Simplified Python interface to the Detector Characterization (DQSEGDB) API. Currently at version 1.3.0, released with support for Python >=3.6. Maintenance is sporadic; no active development observed.

pip install dqsegdb2
error ImportError: cannot import name 'DQSegDB' from 'dqsegdb2'
cause The library was incorrectly installed or the import path is wrong. Common mistake: using `dqsegdb` instead of `dqsegdb2`.
fix
Verify installation: pip show dqsegdb2. Then use from dqsegdb2 import DQSegDB.
error TypeError: __init__() got an unexpected keyword argument 'auth'
cause The `auth` parameter was removed in version 1.2.0.
fix
Provide token instead: DQSegDB(..., token='your_token'). If you need credentials, upgrade your code to obtain a token.
gotcha The old library `dqsegdb` is completely different. Installing `dqsegdb2` does not upgrade `dqsegdb`. You must change import paths.
fix Uninstall dqsegdb and install dqsegdb2. Update imports from dqsegdb to dqsegdb2.
breaking The `DQSegDB` class requires an explicit `token` parameter; earlier versions accepted an `auth` tuple. As of 1.3.0, `auth` is deprecated.
fix Use `token='your_token'` instead of `auth=('user','pass')`.
deprecated The `query_segments()` method is deprecated in favor of `query_active()` and `query_inactive()`.
fix Use `client.query_active(ifo, flag, start, end)` or `client.query_inactive(ifo, flag, start, end)`.

Initialize a DQSegDB client, query flags for a given IFO and time range.

import os
from dqsegdb2 import DQSegDB

client = DQSegDB(base_url='https://segdb.example.com', token=os.environ.get('DQSEGDB_TOKEN', ''))
flags = client.query_flags(ifo='H1', flag='H1_DMT_SCIENCE', start=1234567890, end=1234567990)
for flag in flags:
    print(flag['name'], flag['start_time'], flag['end_time'])