'DBT Cloud API to Extract run artifacts

Using DBT Cloud API, I want to extract the run artifacts and here is what my get request looks like. The response is 200 (success), but how do I download the artifacts.

res = requests.get(
            url=f"https://cloud.getdbt.com/api/v2/accounts/{ACCOUNT_ID}/runs/{JOB_RUN_ID}/artifacts/run_results.json",
            headers={'Authorization': f"Token {API_KEY}", 'Content-Type': 'application/json'},
        )
print('result:', res)


Solution 1:[1]

Your problem is you're not extracting the result from the response. You have to call the following line:

data: dict = res.json()

Then you can operate on the response data.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TobyStack