From dc2d90bafc7e0be5729b6db189b05d7f3eea9628 Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 8 May 2024 10:35:05 +0200 Subject: [PATCH 1/2] disable qdrant example test and fix snippet errors --- docs/tools/prepare_examples_tests.py | 4 ++++ docs/website/docs/general-usage/http/overview.md | 2 +- docs/website/docs/general-usage/http/rest-client.md | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/tools/prepare_examples_tests.py b/docs/tools/prepare_examples_tests.py index c34c7dffd6..a300b1eb8f 100644 --- a/docs/tools/prepare_examples_tests.py +++ b/docs/tools/prepare_examples_tests.py @@ -10,6 +10,7 @@ # settings SKIP_FOLDERS = ["archive", ".", "_", "local_cache"] +SKIP_EXAMPLES = ["qdrant_zendesk"] # the entry point for the script MAIN_CLAUSE = 'if __name__ == "__main__":' @@ -40,6 +41,9 @@ if any(map(lambda skip: example.startswith(skip), SKIP_FOLDERS)): continue + if example in SKIP_EXAMPLES: + continue + count += 1 example_file = f"{EXAMPLES_DIR}/{example}/{example}.py" test_example_file = f"{EXAMPLES_DIR}/{example}/test_{example}.py" diff --git a/docs/website/docs/general-usage/http/overview.md b/docs/website/docs/general-usage/http/overview.md index b8c365f15d..94dc64eac5 100644 --- a/docs/website/docs/general-usage/http/overview.md +++ b/docs/website/docs/general-usage/http/overview.md @@ -58,7 +58,7 @@ from dlt.sources.helpers.rest_client.paginators import JSONResponsePaginator github_client = RESTClient( base_url="https://pokeapi.co/api/v2", - paginator=JSONResponsePaginator(next_url_path="next") # (1) + paginator=JSONResponsePaginator(next_url_path="next"), # (1) data_selector="results", # (2) ) diff --git a/docs/website/docs/general-usage/http/rest-client.md b/docs/website/docs/general-usage/http/rest-client.md index 91abdb2fc1..6eaa91cb6e 100644 --- a/docs/website/docs/general-usage/http/rest-client.md +++ b/docs/website/docs/general-usage/http/rest-client.md @@ -191,7 +191,7 @@ E.g. `https://api.example.com/items?offset=0&limit=100`, `https://api.example.co ```json { - "items": [...], + "items": ["one", "two", "three"], "total": 1000 } ``` @@ -223,7 +223,7 @@ Consider an API endpoint `https://api.example.com/data` returning a structure wh ```json { - "items": [...], + "items": ["one", "two", "three"], "cursors": { "next": "cursor_string_for_next_page" } From 5c979b17be1614a402e9b4ca9304ae21687e80d3 Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 8 May 2024 11:37:42 +0200 Subject: [PATCH 2/2] ignore secrets assignments --- docs/website/docs/general-usage/http/rest-client.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/website/docs/general-usage/http/rest-client.md b/docs/website/docs/general-usage/http/rest-client.md index 6eaa91cb6e..25c5cda7aa 100644 --- a/docs/website/docs/general-usage/http/rest-client.md +++ b/docs/website/docs/general-usage/http/rest-client.md @@ -21,7 +21,7 @@ from dlt.sources.helpers.rest_client.paginators import JSONResponsePaginator client = RESTClient( base_url="https://api.example.com", headers={"User-Agent": "MyApp/1.0"}, - auth=BearerTokenAuth(token="your_access_token_here"), + auth=BearerTokenAuth(token="your_access_token_here"), # type: ignore paginator=JSONResponsePaginator(next_url_path="pagination.next"), data_selector="data", session=MyCustomSession() @@ -318,7 +318,7 @@ from dlt.sources.helpers.rest_client.auth import BearerTokenAuth client = RESTClient( base_url="https://api.example.com", - auth=BearerTokenAuth(token="your_access_token_here") + auth=BearerTokenAuth(token="your_access_token_here") # type: ignore ) for page in client.paginate("/protected/resource"): @@ -341,7 +341,7 @@ API Key Authentication (`ApiKeyAuth`) is an auth method where the client sends a from dlt.sources.helpers.rest_client import RESTClient from dlt.sources.helpers.rest_client.auth import APIKeyAuth -auth = APIKeyAuth(name="X-API-Key", api_key="your_api_key_here", location="header") +auth = APIKeyAuth(name="X-API-Key", api_key="your_api_key_here", location="header") # type: ignore # Create a RESTClient instance with API Key Authentication client = RESTClient(base_url="https://api.example.com", auth=auth) @@ -364,7 +364,7 @@ HTTP Basic Authentication is a simple authentication scheme built into the HTTP from dlt.sources.helpers.rest_client import RESTClient from dlt.sources.helpers.rest_client.auth import HttpBasicAuth -auth = HttpBasicAuth(username="your_username", password="your_password") +auth = HttpBasicAuth(username="your_username", password="your_password") # type: ignore client = RESTClient(base_url="https://api.example.com", auth=auth) response = client.get("/protected/resource")