Hello all :wave: , Can anyone explain me how to pa...
# questions
j
Hello all 👋 , Can anyone explain me how to pass a
HTTPBasicAuth
to an
APIDataSet
?
Copy code
api_ds:
    type: api.APIDataSet
    url: <https://my_url.com/data>
    method: POST
    headers:
      Content-Type: application/json
    credentials: cred
credentials.yml
look like:
Copy code
cred:
    username: XxX
    password: XxX
It then become a tuple, but I would need to make use of
HTTPBasicAuth
function from requests instead. Thanks!
j
Thanks! I managed to do:
Copy code
os.environ["key"] = json.dumps(
    {
        "username": "XxX",
        "password": "XxX",
    }
)

CONFIG_LOADER_ARGS = {
    "custom_resolvers": {
        "HTTPBasicAuth": lambda: HTTPBasicAuth(**json.loads(oc.env("key"))),
    },
}
Is there a way to take the credentials from the
credentials.yml
here?
t
Can you try this in your
credentials.yml
cred:
- username
- password
🌟 1
j
WIth or without the custom_resolver @Takieddine Kadiri?
t
Without the custom_resolver
j
Thank you! It works! Passing as a list instead of a dict.
🙌 1