cernopendata / cernopendata-client

CERN Open Data command-line client
http://cernopendata-client.readthedocs.io/
GNU General Public License v3.0
10 stars 9 forks source link

configuration: allow setting alternative server URL #31

Closed tiborsimko closed 4 years ago

tiborsimko commented 4 years ago

Currently the cernopendata-client is querying opendata.cern.ch instance, and this is hard-coded:

$ rg opendata.cern.ch
cernopendata_client/cli.py
24:SEARCH_URL = "http://opendata.cern.ch/api/records/"
103:                    "root://eospublic.cern.ch/", "http://opendata.cern.ch"
117:            f.replace("root://eospublic.cern.ch/", "http://opendata.cern.ch")

It would be good to allow querying opendata-qa.cern.ch or opendata-dev.cern.ch instances, both for testing purposes and when working with open data releases that take a long time to "mature" on the DEV or QA instances before making it to the PROD instance.

We could solve it by adding a new command-line option (--server <url>) to each CLI command, where users could pass a wanted server instance, for example:

$ cernopendata-client get-file-locations --recid 15007 --protocol http --server http://opendata-dev.cern.ch

If the option is not used, the client would connect by default to http://opendata.cern.ch.