aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2022-04-26 15:16:27 -0700
committerBryan Newbold <bnewbold@archive.org>2022-04-26 15:16:27 -0700
commitddcab9f3f44fd921bb70021674fb4052efd604f0 (patch)
tree4042bef419e6082ca68bea1a75c3337180dc4224
parent6ffdefc8fb08f64563645fe7bf9f2257dc9803ab (diff)
downloadsandcrawler-ddcab9f3f44fd921bb70021674fb4052efd604f0.tar.gz
sandcrawler-ddcab9f3f44fd921bb70021674fb4052efd604f0.zip
ingest_tool: spn-status command to check user's quota
-rwxr-xr-xpython/ingest_tool.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/ingest_tool.py b/python/ingest_tool.py
index a155842..ac9ece1 100755
--- a/python/ingest_tool.py
+++ b/python/ingest_tool.py
@@ -115,6 +115,20 @@ def run_file_requests_backfill(args):
pusher.run()
+def run_spn_status(args):
+ worker = IngestFileWorker(
+ sink=None,
+ try_spn2=False,
+ )
+
+ resp = worker.spn_client.v2_session.get("https://web.archive.org/save/status/system")
+ resp.raise_for_status()
+ print(f"System status: {json.dumps(resp.json(), sort_keys=True)}")
+ resp = worker.spn_client.v2_session.get("https://web.archive.org/save/status/user")
+ resp.raise_for_status()
+ print(f"User status: {json.dumps(resp.json(), sort_keys=True)}")
+
+
def run_api(args):
port = 8083
print("Listening on localhost:{}".format(port))
@@ -204,6 +218,11 @@ def main():
"--grobid-host", default="https://grobid.qa.fatcat.wiki", help="GROBID API host/port"
)
+ sub_spn_status = subparsers.add_parser(
+ "spn-status", help="checks save-page-now v2 API status for bot user"
+ )
+ sub_spn_status.set_defaults(func=run_spn_status)
+
args = parser.parse_args()
if not args.__dict__.get("func"):
parser.print_help(file=sys.stderr)