https://kedro.org/ logo
#beginners-need-help
Title
# beginners-need-help
i

Ian Whalen

12/03/2021, 7:07 PM
So it was a little of both! I wasn't aware that credentials explicitly only filled in
credentials
keys. I fixed this by adding a
credentials
kwarg to my child class. Here's my class if anyone is interested:
Copy code
python
from typing import Any, Dict, Iterable, List, Union
from requests.auth import AuthBase
from kedro.extras.datasets.api import APIDataSet

class AuthorizableAPIDataSet(APIDataSet):
    def __init__(
        self,
        url: str,
        method: str = "GET",
        data: Any = None,
        params: Dict[str, Any] = None,
        headers: Dict[str, Any] = None,
        auth: Union[Iterable[str], AuthBase] = None,
        json: Union[List, Dict[str, Any]] = None,
        timeout: int = 60,
        credentials: Union[Iterable[str], AuthBase] = None,
    ) -> None:
        if credentials is not None and auth is not None:
            raise ValueError("Cannot specify both auth and credentials.")

        auth = credentials or auth

        if isinstance(auth, Iterable):
            auth = tuple(auth)

        super().__init__(
            url=url,
            method=method,
            data=data,
            params=params,
            headers=headers,
            auth=auth,
            json=json,
            timeout=timeout,
        )