Gitlab Community Edition Instance

Commit 50550d73 authored by mhellka's avatar mhellka
Browse files

Remove sensitive information from CDSTar.url string.

parent a4059a07
......@@ -7,7 +7,7 @@ import typing
import requests
from pycdstar3._utils import PATH_TYPES
from pycdstar3._utils import PATH_TYPES, url_split_auth
from pycdstar3.model import ApiError, JsonObject, FileDownload, FormUpdate
__all__ = "CDStar", "CDStarVault", "FormUpdate", "ApiError"
......@@ -25,14 +25,20 @@ def _fix_filename(name):
class CDStar:
""" Provide low-level methods for corresponding server-side REST endpoints.
If not documented otherwise, each method call triggers exactly one REST
request and return a :class:`pycdstar3.model.JsonObject`, which offers dict-like and attribute access to json fields.
If not documented otherwise, each method call triggers exactly one REST request and return
a :class:`pycdstar3.model.JsonObject`, which offers dict-like and attribute access to json fields.
There is no internal caching. The only state that is tracked by this class is the running transaction, if any.
:param url: CDSTAR API URL, with or without auth information
:param auth: A (username, password) tuple, or None.
"""
def __init__(self, url, auth=None, _session=None):
self.url = url.rstrip("/") + '/'
self.auth = auth
url, username, password = url_split_auth(url)
if not url.endswith("/"):
url += "/"
self.url = url
self.auth = auth or username and (username, password)
self._session = _session or requests.Session()
self._tx = None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment