dbs3-pycurl

raw JSON →
3.18.3 verified Fri May 01 auth: no python

DBS3 Pycurl Client is a Python library providing a pycurl-based HTTP client for interacting with the CMS Data Bookkeeping Service (DBS). Version 3.18.3 is currently available, with last release in 2023-2024, and it follows the DBS3 release schedule.

pip install dbs3-pycurl
error ImportError: No module named dbs.apis.dbsClient
cause The package dbs3-pycurl is not installed or installed in a different environment.
fix
Run 'pip install dbs3-pycurl' and ensure it is in the same Python environment.
error pycurl.error: (7, 'Failed to connect to address')
cause Network issue or incorrect DBS server URL.
fix
Check the URL for typos and ensure network connectivity (e.g., VPN or CERN proxy).
error dbs.exceptions.DBSException: Invalid input parameter
cause The dataset name or path is malformed or does not exist.
fix
Verify the dataset name format (e.g., /primary/proc/datatype). Use listDatasets to check availability.
gotcha The DBSClient and DBSReader classes are not thread-safe. Do not share instances across threads without locks.
fix Create a new client instance per thread or use threading locks.
deprecated The 'dbs.apis.dbsClient' API is gradually being replaced by REST-based clients. Check for 'DBS3Client' or direct REST calls in newer releases.
fix Monitor release notes for deprecation timelines and migrate to REST.
gotcha The library uses pycurl under the hood; ensure that the system has libcurl installed and pycurl is compiled with SSL support to avoid connection errors.
fix Install pycurl with SSL support, e.g., 'PYCURL_SSL_LIBRARY=openssl pip install pycurl'.

Initialize DBSReader with production URL and fetch dataset summary.

from dbs.apis.dbsClient import DBSReader
import os

# Example: fetch dataset summary by dataset
reader = DBSReader(url="https://cmsweb.cern.ch/dbs/prod/global/DBSReader")
dataset = "/Sample/Sample-4342-0003/GEN-SIM"
summary = reader.listDatasetSummary(dataset=dataset)
print(summary)