Skip to content
Snippets Groups Projects
Verified Commit 45d4ffa9 authored by Duncan Macleod's avatar Duncan Macleod Committed by Duncan Macleod
Browse files

requests: new thin wrapper around Session

with default token_scope set properly
parent cbadc54c
No related branches found
No related tags found
1 merge request!86Draft: Provide custom Session wrapper with default token_scope
...@@ -81,9 +81,9 @@ For example: ...@@ -81,9 +81,9 @@ For example:
'L': ['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/L1/1186988032/L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf']} 'L': ['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/L1/1186988032/L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf']}
""" # noqa: E501 """ # noqa: E501
from igwn_auth_utils.requests import Session
from .http import * from .http import *
from .requests import Session
from .ui import * from .ui import *
__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>' __author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
......
# Copyright (C) Cardiff University (2023-2025)
#
# This file is part of GWDataFind.
#
# GWDataFind is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GWDataFind is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GWDataFind. If not, see <http://www.gnu.org/licenses/>.
"""Thin :class:`igwn_auth_utils.Session` wrapper that sets the
default ``token_scope`` appropriately.
"""
from functools import wraps
from igwn_auth_utils.requests import Session as _Session
DEFAULT_TOKEN_SCOPE = "gwdatafind.read" # noqa: S105
class Session(_Session):
@wraps(_Session.__init__)
def __init__(self, *args, **kwargs):
kwargs.setdefault("token_scope", DEFAULT_TOKEN_SCOPE)
super().__init__(*args, **kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment