From 41299e8b97d975f8dca84f2a6d7cbec3d37f5f3b Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 8 May 2023 01:05:26 -0500 Subject: [PATCH] foiaghost incremental and ssl error --- README.md | 2 +- examples/foiaghost.py | 11 ++++++++++- src/beakers/beakers.py | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4c8ee7e..96b5222 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ por bkr --recipe examples.fruits.recipe show por bkr --recipe examples.fruits.recipe reset por bkr --recipe examples.fruits.recipe run --input words=examples/fruits.csv -por bkr --recipe examples.fruits.recipe show + ``` ## Michael's Email diff --git a/examples/foiaghost.py b/examples/foiaghost.py index 6d6546c..9c95792 100644 --- a/examples/foiaghost.py +++ b/examples/foiaghost.py @@ -1,3 +1,4 @@ +from ssl import SSLCertVerificationError, SSLError import httpx from beakers.beakers import Beaker from beakers.recipe import Recipe @@ -32,5 +33,13 @@ recipe.add_transform( "good_urls", "responses", add_response, - error_map={(httpx.ConnectError, httpx.ConnectTimeout): "bad_requests"}, + error_map={ + ( + httpx.ConnectError, + httpx.ConnectTimeout, + httpx.ReadTimeout, + SSLCertVerificationError, + SSLError, + ): "bad_requests" + }, ) diff --git a/src/beakers/beakers.py b/src/beakers/beakers.py index 6d06475..7f8033b 100644 --- a/src/beakers/beakers.py +++ b/src/beakers/beakers.py @@ -68,7 +68,8 @@ class SqliteBeaker(Beaker): def add_item(self, item: dict, from_table=None, from_id=None) -> None: self.cursor.execute( - f"INSERT INTO {self.name} (data) VALUES (?)", (json.dumps(item),) + f"INSERT INTO {self.name} (data, from_table, from_id) VALUES (?, ?, ?)", + (json.dumps(item), from_table, from_id), ) self.recipe.db.commit()