diff --git a/notebooks/api_search_tests.ipynb b/notebooks/api_search_tests.ipynb index e633e94..af6ec53 100644 --- a/notebooks/api_search_tests.ipynb +++ b/notebooks/api_search_tests.ipynb @@ -17,7 +17,11 @@ "metadata": {}, "outputs": [], "source": [ - "client = KptnCookClient()" + "from kptncook import Settings\n", + "\n", + "settings = Settings()\n", + "client = KptnCookClient(base_url=settings.kptncook_api_url, api_key=settings.kptncook_api_key,\n", + " access_token=settings.kptncook_access_token)" ] }, { diff --git a/notebooks/issue_25_broken_urls.ipynb b/notebooks/issue_25_broken_urls.ipynb index 316c7bd..51671a0 100644 --- a/notebooks/issue_25_broken_urls.ipynb +++ b/notebooks/issue_25_broken_urls.ipynb @@ -2,31 +2,55 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, "id": "0272802b-0e1a-4d20-950c-e37bca495e14", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-01-01T21:29:51.124582Z", + "start_time": "2025-01-01T21:29:51.122387Z" + } + }, "source": [ "from getpass import getpass\n", "\n", "from kptncook.api import KptnCookClient" - ] + ], + "outputs": [], + "execution_count": 3 }, { "cell_type": "code", - "execution_count": 3, "id": "c4c9892a-41ed-4741-b2b3-11a293213c9d", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-01-01T21:29:51.156264Z", + "start_time": "2025-01-01T21:29:51.154545Z" + } + }, "source": [ "# list_kptncook_today()" - ] + ], + "outputs": [], + "execution_count": 4 }, { "cell_type": "code", - "execution_count": 5, "id": "ea3cbd2c-b50b-4ce3-8e98-7ac58c60de76", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2025-01-01T21:29:51.448015Z", + "start_time": "2025-01-01T21:29:51.169670Z" + } + }, + "source": [ + "from kptncook import Settings\n", + "\n", + "settings = Settings()\n", + "client = KptnCookClient(base_url=settings.kptncook_api_url, api_key=settings.kptncook_api_key,\n", + " access_token=settings.kptncook_access_token)\n", + "\n", + "all_recipes = client.list_today()\n", + "len(all_recipes)" + ], "outputs": [ { "data": { @@ -39,51 +63,51 @@ "output_type": "execute_result" } ], - "source": [ - "client = KptnCookClient()\n", - "all_recipes = client.list_today()\n", - "len(all_recipes)" - ] + "execution_count": 5 }, { "cell_type": "code", - "execution_count": 3, "id": "4f439dd5-5ee2-4e2e-afc9-b6e284e7d5e2", - "metadata": {}, - "outputs": [ - { - "name": "stdin", - "output_type": "stream", - "text": [ - " ········\n" - ] + "metadata": { + "ExecuteTime": { + "end_time": "2025-01-01T21:29:55.743764Z", + "start_time": "2025-01-01T21:29:51.455216Z" } - ], + }, "source": [ "username = \"jochen-kptncook@wersdoerfer.de\"\n", "password = getpass()" - ] + ], + "outputs": [], + "execution_count": 6 }, { "cell_type": "code", - "execution_count": 6, "id": "701f5cd6-7bfb-4545-8e82-c455397709f4", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2025-01-01T21:29:55.959152Z", + "start_time": "2025-01-01T21:29:55.759Z" + } + }, + "source": [ + "client.get_access_token(username, password)" + ], "outputs": [ { - "data": { - "text/plain": [ - "'93533997-b764-4fe1-8710-ef6a4a173805'" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" + "ename": "KeyError", + "evalue": "'accessToken'", + "output_type": "error", + "traceback": [ + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mKeyError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[7], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mclient\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_access_token\u001B[49m\u001B[43m(\u001B[49m\u001B[43musername\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpassword\u001B[49m\u001B[43m)\u001B[49m\n", + "File \u001B[0;32m~/repositories/kptncook/kptncook/api.py:89\u001B[0m, in \u001B[0;36mKptnCookClient.get_access_token\u001B[0;34m(self, username, password)\u001B[0m\n\u001B[1;32m 87\u001B[0m response\u001B[38;5;241m.\u001B[39mraise_for_status()\n\u001B[1;32m 88\u001B[0m token_data \u001B[38;5;241m=\u001B[39m response\u001B[38;5;241m.\u001B[39mjson()\n\u001B[0;32m---> 89\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mtoken_data\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43maccessToken\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\n", + "\u001B[0;31mKeyError\u001B[0m: 'accessToken'" + ] } ], - "source": [ - "client.get_access_token(username, password)" - ] + "execution_count": 7 }, { "cell_type": "code", diff --git a/notebooks/test_new_headers.ipynb b/notebooks/test_new_headers.ipynb index d27b99e..aa4ae6c 100644 --- a/notebooks/test_new_headers.ipynb +++ b/notebooks/test_new_headers.ipynb @@ -23,7 +23,11 @@ "metadata": {}, "outputs": [], "source": [ - "client = KptnCookClient()" + "from kptncook import Settings\n", + "\n", + "settings = Settings()\n", + "client = KptnCookClient(base_url=settings.kptncook_api_url, api_key=settings.kptncook_api_key,\n", + " access_token=settings.kptncook_access_token)" ] }, {