api-everything 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- api_everything/__init__.py +3 -0
- api_everything/__main__.py +8 -0
- api_everything/check.py +168 -0
- api_everything/chrome_cmd.py +131 -0
- api_everything/cli.py +803 -0
- api_everything/config.py +321 -0
- api_everything/delivery.py +518 -0
- api_everything/delivery_git.py +94 -0
- api_everything/driver/__init__.py +37 -0
- api_everything/driver/attach.py +95 -0
- api_everything/driver/base.py +80 -0
- api_everything/driver/chrome.py +127 -0
- api_everything/driver/profile.py +84 -0
- api_everything/engine.py +381 -0
- api_everything/errors.py +23 -0
- api_everything/hooks.py +52 -0
- api_everything/login.py +95 -0
- api_everything/mcp_bridge.py +249 -0
- api_everything/metrics.py +87 -0
- api_everything/mock_site/__init__.py +5 -0
- api_everything/mock_site/__main__.py +18 -0
- api_everything/mock_site/app.py +262 -0
- api_everything/pipeline.py +934 -0
- api_everything/pool.py +553 -0
- api_everything/ratelimit.py +67 -0
- api_everything/recipe/__init__.py +6 -0
- api_everything/recipe/actions.py +56 -0
- api_everything/recipe/jsonpath.py +22 -0
- api_everything/recipe/loader.py +142 -0
- api_everything/recipe/params.py +120 -0
- api_everything/recipe/schema.py +235 -0
- api_everything/recipes/alignmentforum/feed.yaml +15 -0
- api_everything/recipes/alpine_docs/search.yaml +32 -0
- api_everything/recipes/angular_docs/search.yaml +32 -0
- api_everything/recipes/anthropic_status/summary.yaml +17 -0
- api_everything/recipes/apis_guru/providers.yaml +15 -0
- api_everything/recipes/arbeitnow/jobs.yaml +20 -0
- api_everything/recipes/arin_rdap/ip.yaml +24 -0
- api_everything/recipes/artifacthub/browse.yaml +22 -0
- api_everything/recipes/artifacthub/search.yaml +24 -0
- api_everything/recipes/astro_docs/search.yaml +32 -0
- api_everything/recipes/atlassian_status/summary.yaml +17 -0
- api_everything/recipes/babel_docs/search.yaml +32 -0
- api_everything/recipes/binance/price.yaml +24 -0
- api_everything/recipes/bugzilla/bugs.yaml +24 -0
- api_everything/recipes/bundlephobia/size.yaml +24 -0
- api_everything/recipes/caddy_docs/search.yaml +32 -0
- api_everything/recipes/caniuse/search.yaml +24 -0
- api_everything/recipes/capacitor_docs/search.yaml +32 -0
- api_everything/recipes/cdnjs/library.yaml +22 -0
- api_everything/recipes/cdnjs/search.yaml +27 -0
- api_everything/recipes/certspotter/issuances.yaml +27 -0
- api_everything/recipes/cheerio_docs/search.yaml +32 -0
- api_everything/recipes/circleci_status/summary.yaml +17 -0
- api_everything/recipes/cisa_kev/catalog.yaml +17 -0
- api_everything/recipes/civitai/models.yaml +26 -0
- api_everything/recipes/cloudflare_status/summary.yaml +17 -0
- api_everything/recipes/cncf_landscape/projects.yaml +20 -0
- api_everything/recipes/cncf_landscape/ui.yaml +18 -0
- api_everything/recipes/coinbase/rates.yaml +24 -0
- api_everything/recipes/coingecko/trending.yaml +17 -0
- api_everything/recipes/conda_forge/package.yaml +25 -0
- api_everything/recipes/crates/categories.yaml +15 -0
- api_everything/recipes/crates/downloads.yaml +22 -0
- api_everything/recipes/crates/keywords.yaml +15 -0
- api_everything/recipes/crates/reverse_deps.yaml +22 -0
- api_everything/recipes/crates/search.yaml +24 -0
- api_everything/recipes/crates/summary.yaml +15 -0
- api_everything/recipes/crates/user.yaml +22 -0
- api_everything/recipes/crates/versions.yaml +22 -0
- api_everything/recipes/crossref/works.yaml +24 -0
- api_everything/recipes/cve_org/record.yaml +24 -0
- api_everything/recipes/debian_sources/search.yaml +24 -0
- api_everything/recipes/deps_dev/npm_spa.yaml +22 -0
- api_everything/recipes/deps_dev/package.yaml +23 -0
- api_everything/recipes/devdocs/index.yaml +18 -0
- api_everything/recipes/devto/articles.yaml +26 -0
- api_everything/recipes/devto/latest.yaml +18 -0
- api_everything/recipes/devto/tags.yaml +18 -0
- api_everything/recipes/devto/top.yaml +18 -0
- api_everything/recipes/digitalocean_status/summary.yaml +17 -0
- api_everything/recipes/digitalocean_status/ui.yaml +15 -0
- api_everything/recipes/discord_status/summary.yaml +17 -0
- api_everything/recipes/dns_google/resolve.yaml +24 -0
- api_everything/recipes/drizzle_docs/search.yaml +32 -0
- api_everything/recipes/echojs/latest.yaml +17 -0
- api_everything/recipes/ecosystems/package.yaml +25 -0
- api_everything/recipes/endoflife/product.yaml +24 -0
- api_everything/recipes/epss/score.yaml +24 -0
- api_everything/recipes/exchangerate/latest.yaml +24 -0
- api_everything/recipes/firefox_addons/search.yaml +26 -0
- api_everything/recipes/fly_status/summary.yaml +17 -0
- api_everything/recipes/formik_docs/search.yaml +32 -0
- api_everything/recipes/frankfurter/rates.yaml +24 -0
- api_everything/recipes/gcp_status/incidents.yaml +20 -0
- api_everything/recipes/github/explore.yaml +35 -0
- api_everything/recipes/github/gists.yaml +18 -0
- api_everything/recipes/github/issues.yaml +30 -0
- api_everything/recipes/github/license.yaml +23 -0
- api_everything/recipes/github/org.yaml +22 -0
- api_everything/recipes/github/releases.yaml +30 -0
- api_everything/recipes/github/repo.yaml +28 -0
- api_everything/recipes/github/user.yaml +22 -0
- api_everything/recipes/github_advisories/list.yaml +20 -0
- api_everything/recipes/github_status/summary.yaml +17 -0
- api_everything/recipes/github_status/ui.yaml +15 -0
- api_everything/recipes/gitlab/issues.yaml +24 -0
- api_everything/recipes/gitlab/repo.yaml +21 -0
- api_everything/recipes/gitlab/search.yaml +26 -0
- api_everything/recipes/go_proxy/latest.yaml +24 -0
- api_everything/recipes/grafana_status/summary.yaml +17 -0
- api_everything/recipes/hackage/versions.yaml +24 -0
- api_everything/recipes/hackernews/ask.yaml +18 -0
- api_everything/recipes/hackernews/front_page.yaml +18 -0
- api_everything/recipes/hackernews/item.yaml +21 -0
- api_everything/recipes/hackernews/jobs.yaml +18 -0
- api_everything/recipes/hackernews/latest.yaml +25 -0
- api_everything/recipes/hackernews/search.yaml +34 -0
- api_everything/recipes/hackernews/show.yaml +18 -0
- api_everything/recipes/hashicorp_releases/list.yaml +27 -0
- api_everything/recipes/hashicorp_status/summary.yaml +17 -0
- api_everything/recipes/helm_docs/search.yaml +32 -0
- api_everything/recipes/heroku_status/current.yaml +17 -0
- api_everything/recipes/hexpm/search.yaml +27 -0
- api_everything/recipes/hf_papers/daily.yaml +20 -0
- api_everything/recipes/himalayas/jobs.yaml +17 -0
- api_everything/recipes/homebrew/cask.yaml +22 -0
- api_everything/recipes/homebrew/formula.yaml +26 -0
- api_everything/recipes/hono_docs/search.yaml +32 -0
- api_everything/recipes/httpbin/json.yaml +17 -0
- api_everything/recipes/httpbin/uuid.yaml +15 -0
- api_everything/recipes/huggingface/datasets.yaml +25 -0
- api_everything/recipes/huggingface/model_info.yaml +27 -0
- api_everything/recipes/huggingface/models.yaml +28 -0
- api_everything/recipes/huggingface/spaces.yaml +25 -0
- api_everything/recipes/inspirehep/papers.yaml +24 -0
- api_everything/recipes/ionic_docs/search.yaml +32 -0
- api_everything/recipes/ipify/ipv4.yaml +17 -0
- api_everything/recipes/ipwho/lookup.yaml +24 -0
- api_everything/recipes/jest_docs/search.yaml +32 -0
- api_everything/recipes/jsdelivr/gh.yaml +27 -0
- api_everything/recipes/jsdelivr/npm.yaml +24 -0
- api_everything/recipes/jsr/search.yaml +27 -0
- api_everything/recipes/launchdarkly_status/summary.yaml +17 -0
- api_everything/recipes/lemmy/hot.yaml +17 -0
- api_everything/recipes/lesswrong/feed.yaml +17 -0
- api_everything/recipes/llamaindex_docs/search.yaml +32 -0
- api_everything/recipes/lobsters/hottest.yaml +20 -0
- api_everything/recipes/luma/category.yaml +22 -0
- api_everything/recipes/luma/events.yaml +17 -0
- api_everything/recipes/mastodon/explore.yaml +26 -0
- api_everything/recipes/mastodon/tag.yaml +23 -0
- api_everything/recipes/mastodon/trends_tags.yaml +18 -0
- api_everything/recipes/mdn/search.yaml +24 -0
- api_everything/recipes/metacpan/search.yaml +24 -0
- api_everything/recipes/microlink/preview.yaml +24 -0
- api_everything/recipes/mikro_orm_docs/search.yaml +32 -0
- api_everything/recipes/mock/items.yaml +35 -0
- api_everything/recipes/mongodb_status/summary.yaml +17 -0
- api_everything/recipes/nager_date/holidays.yaml +32 -0
- api_everything/recipes/neon_docs/search.yaml +32 -0
- api_everything/recipes/nestjs_docs/search.yaml +32 -0
- api_everything/recipes/netlify_status/summary.yaml +17 -0
- api_everything/recipes/nextjs_docs/search.yaml +32 -0
- api_everything/recipes/nodejs_dist/releases.yaml +17 -0
- api_everything/recipes/npm/dist_tags.yaml +22 -0
- api_everything/recipes/npm/package.yaml +25 -0
- api_everything/recipes/npm/search.yaml +25 -0
- api_everything/recipes/npm_downloads/weekly.yaml +24 -0
- api_everything/recipes/npm_status/summary.yaml +17 -0
- api_everything/recipes/npmtrends/compare.yaml +22 -0
- api_everything/recipes/nuget/search.yaml +27 -0
- api_everything/recipes/nuxt_docs/search.yaml +32 -0
- api_everything/recipes/nvd/cve.yaml +22 -0
- api_everything/recipes/nvd/cves.yaml +24 -0
- api_everything/recipes/open_elevation/lookup.yaml +29 -0
- api_everything/recipes/openai_status/summary.yaml +17 -0
- api_everything/recipes/opencollective/search.yaml +22 -0
- api_everything/recipes/openfda/events.yaml +17 -0
- api_everything/recipes/openlibrary/search.yaml +24 -0
- api_everything/recipes/openmeteo/forecast.yaml +17 -0
- api_everything/recipes/openrouter/models.yaml +20 -0
- api_everything/recipes/openstreetmap/geocode.yaml +27 -0
- api_everything/recipes/openstreetmap/reverse.yaml +27 -0
- api_everything/recipes/osv/vuln.yaml +24 -0
- api_everything/recipes/packagist/search.yaml +27 -0
- api_everything/recipes/peps/list.yaml +17 -0
- api_everything/recipes/pinia_docs/search.yaml +32 -0
- api_everything/recipes/pkg_go_dev/browse.yaml +15 -0
- api_everything/recipes/pkg_go_dev/package.yaml +25 -0
- api_everything/recipes/playwright_docs/search.yaml +32 -0
- api_everything/recipes/pnpm_docs/search.yaml +32 -0
- api_everything/recipes/pokeapi/pokemon.yaml +24 -0
- api_everything/recipes/posthog_docs/search.yaml +32 -0
- api_everything/recipes/postman_echo/get.yaml +24 -0
- api_everything/recipes/postman_status/summary.yaml +17 -0
- api_everything/recipes/preact_docs/search.yaml +32 -0
- api_everything/recipes/pubdev/search.yaml +24 -0
- api_everything/recipes/pubmed/search.yaml +24 -0
- api_everything/recipes/puppeteer_docs/search.yaml +32 -0
- api_everything/recipes/pypi/package.yaml +24 -0
- api_everything/recipes/pypi/version.yaml +27 -0
- api_everything/recipes/quay/search.yaml +27 -0
- api_everything/recipes/quora/answers.yaml +46 -0
- api_everything/recipes/qwik_docs/search.yaml +32 -0
- api_everything/recipes/ray_docs/search.yaml +32 -0
- api_everything/recipes/rdap/domain.yaml +24 -0
- api_everything/recipes/react_docs/search.yaml +32 -0
- api_everything/recipes/react_hook_form_docs/search.yaml +32 -0
- api_everything/recipes/reactrouter_docs/search.yaml +32 -0
- api_everything/recipes/reddit/search.yaml +48 -0
- api_everything/recipes/reddit_status/summary.yaml +17 -0
- api_everything/recipes/remoteok/jobs.yaml +17 -0
- api_everything/recipes/render_status/summary.yaml +17 -0
- api_everything/recipes/repology/project.yaml +24 -0
- api_everything/recipes/ripe_stat/prefix.yaml +24 -0
- api_everything/recipes/rollup_docs/search.yaml +32 -0
- api_everything/recipes/rsbuild_docs/search.yaml +32 -0
- api_everything/recipes/rubygems/gem.yaml +22 -0
- api_everything/recipes/rubygems/search.yaml +27 -0
- api_everything/recipes/sendgrid_status/summary.yaml +17 -0
- api_everything/recipes/sequelize_docs/search.yaml +32 -0
- api_everything/recipes/shodan_internetdb/host.yaml +24 -0
- api_everything/recipes/shopify_status/summary.yaml +17 -0
- api_everything/recipes/sigstore_rekor/log.yaml +17 -0
- api_everything/recipes/slack_status/current.yaml +17 -0
- api_everything/recipes/spdx/licenses.yaml +17 -0
- api_everything/recipes/stackexchange/sites.yaml +20 -0
- api_everything/recipes/stackoverflow/answers.yaml +15 -0
- api_everything/recipes/stackoverflow/questions.yaml +18 -0
- api_everything/recipes/stackoverflow/search.yaml +27 -0
- api_everything/recipes/stackoverflow/tags.yaml +18 -0
- api_everything/recipes/strapi_docs/search.yaml +32 -0
- api_everything/recipes/strawberry_docs/search.yaml +32 -0
- api_everything/recipes/stripe_status/current.yaml +17 -0
- api_everything/recipes/substack/explore.yaml +22 -0
- api_everything/recipes/substack/search.yaml +31 -0
- api_everything/recipes/sunrise_sunset/times.yaml +29 -0
- api_everything/recipes/supabase_status/summary.yaml +17 -0
- api_everything/recipes/swr_docs/search.yaml +32 -0
- api_everything/recipes/tanstack_docs/search.yaml +32 -0
- api_everything/recipes/tc39/proposals.yaml +20 -0
- api_everything/recipes/techempower/results.yaml +15 -0
- api_everything/recipes/temporal_docs/search.yaml +32 -0
- api_everything/recipes/terraform_registry/browse.yaml +25 -0
- api_everything/recipes/terraform_registry/search.yaml +24 -0
- api_everything/recipes/testing_library_docs/search.yaml +32 -0
- api_everything/recipes/tvmaze/shows.yaml +24 -0
- api_everything/recipes/twilio_status/summary.yaml +17 -0
- api_everything/recipes/upstash_docs/search.yaml +32 -0
- api_everything/recipes/valibot_docs/search.yaml +32 -0
- api_everything/recipes/vercel_status/summary.yaml +17 -0
- api_everything/recipes/vercel_status/ui.yaml +15 -0
- api_everything/recipes/vue_docs/search.yaml +32 -0
- api_everything/recipes/w3c/specs.yaml +17 -0
- api_everything/recipes/wayback/available.yaml +24 -0
- api_everything/recipes/webdriverio_docs/search.yaml +32 -0
- api_everything/recipes/webpack_docs/search.yaml +32 -0
- api_everything/recipes/wikidata/entity.yaml +22 -0
- api_everything/recipes/wikidata/search.yaml +24 -0
- api_everything/recipes/wikimedia_commons/search.yaml +25 -0
- api_everything/recipes/wikipedia/search.yaml +25 -0
- api_everything/recipes/wikipedia/summary.yaml +33 -0
- api_everything/recipes/wordpress_plugins/search.yaml +24 -0
- api_everything/recipes/wordpress_themes/search.yaml +24 -0
- api_everything/recipes/worldbank/indicator.yaml +17 -0
- api_everything/recipes/zenodo/records.yaml +24 -0
- api_everything/recipes/zippopotam/in.yaml +22 -0
- api_everything/recipes/zippopotam/lookup.yaml +29 -0
- api_everything/recipes/zoom_status/summary.yaml +17 -0
- api_everything/record.py +327 -0
- api_everything/record_session.py +364 -0
- api_everything/repair.py +717 -0
- api_everything/repair_ai.py +194 -0
- api_everything/runlog.py +61 -0
- api_everything/server.py +323 -0
- api_everything-0.5.0.dist-info/METADATA +363 -0
- api_everything-0.5.0.dist-info/RECORD +281 -0
- api_everything-0.5.0.dist-info/WHEEL +4 -0
- api_everything-0.5.0.dist-info/entry_points.txt +2 -0
- api_everything-0.5.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""JSONPath helpers shared by `extract:` and the live `check:` assertions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from jsonpath_ng.ext import parse
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@lru_cache(maxsize=256)
|
|
12
|
+
def compile_path(path: str):
|
|
13
|
+
"""Parse a JSONPath expression, raising ValueError with a readable message."""
|
|
14
|
+
try:
|
|
15
|
+
return parse(path)
|
|
16
|
+
except Exception as exc: # the parser raises several unrelated error types
|
|
17
|
+
raise ValueError(f"not a valid JSONPath: {path!r} ({type(exc).__name__})") from exc
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def find_all(path: str, data: Any) -> list[Any]:
|
|
21
|
+
"""Every value the path selects, in document order. An absent path gives an empty list."""
|
|
22
|
+
return [match.value for match in compile_path(path).find(data)]
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Load and validate recipes from directories.
|
|
2
|
+
|
|
3
|
+
Layout: one folder per site, one file per endpoint. `recipes/reddit/search.yaml` is the
|
|
4
|
+
recipe `reddit.search`, and its `name:` must say so. Directories are read in order and a
|
|
5
|
+
later directory overrides an earlier one by name, so a user's own recipe replaces a bundled
|
|
6
|
+
one with the same name.
|
|
7
|
+
|
|
8
|
+
Loading is fail-fast: every problem in every file is collected and reported together, with
|
|
9
|
+
the file and field named, and the daemon refuses to start with a bad recipe.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from collections.abc import Collection
|
|
15
|
+
from dataclasses import dataclass, field
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
import yaml
|
|
19
|
+
from pydantic import ValidationError
|
|
20
|
+
|
|
21
|
+
from api_everything.hooks import HookError, load_hook
|
|
22
|
+
from api_everything.recipe.schema import Recipe
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def bundled_recipes_dir() -> Path:
|
|
26
|
+
"""The reference recipes shipped inside the package."""
|
|
27
|
+
return Path(__file__).resolve().parents[1] / "recipes"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class RecipeLoadError(Exception):
|
|
31
|
+
"""One or more recipes are invalid. `problems` lists each one."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, problems: list[str]) -> None:
|
|
34
|
+
super().__init__("\n".join(problems))
|
|
35
|
+
self.problems = problems
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class LoadedRecipes:
|
|
40
|
+
recipes: dict[str, Recipe] = field(default_factory=dict)
|
|
41
|
+
sources: dict[str, Path] = field(default_factory=dict)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _problems_from_validation(path: Path, exc: ValidationError) -> list[str]:
|
|
45
|
+
problems = []
|
|
46
|
+
for err in exc.errors():
|
|
47
|
+
where = ".".join(str(part) for part in err["loc"]) or "recipe"
|
|
48
|
+
problems.append(f"{path}: {where}: {err['msg']}")
|
|
49
|
+
return problems
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _load_file(
|
|
53
|
+
path: Path,
|
|
54
|
+
site: str,
|
|
55
|
+
*,
|
|
56
|
+
allow_eval: bool,
|
|
57
|
+
eval_in_profiles: Collection[str],
|
|
58
|
+
hooks_dir: Path | None,
|
|
59
|
+
) -> tuple[Recipe | None, list[str]]:
|
|
60
|
+
try:
|
|
61
|
+
raw = yaml.safe_load(path.read_text())
|
|
62
|
+
except (OSError, yaml.YAMLError) as exc:
|
|
63
|
+
return None, [f"{path}: cannot read as YAML: {exc}"]
|
|
64
|
+
if not isinstance(raw, dict):
|
|
65
|
+
return None, [f"{path}: must contain a mapping at the top level"]
|
|
66
|
+
try:
|
|
67
|
+
recipe = Recipe.model_validate(raw)
|
|
68
|
+
except ValidationError as exc:
|
|
69
|
+
return None, _problems_from_validation(path, exc)
|
|
70
|
+
|
|
71
|
+
problems: list[str] = []
|
|
72
|
+
expected = f"{site}.{path.stem}"
|
|
73
|
+
if recipe.name != expected:
|
|
74
|
+
problems.append(f"{path}: name: is {recipe.name!r} but the file path says {expected!r}")
|
|
75
|
+
if recipe.uses_eval and not allow_eval:
|
|
76
|
+
problems.append(f"{path}: actions: uses eval, which needs allow_eval: true in the config")
|
|
77
|
+
elif recipe.uses_eval and recipe.profile_name and recipe.name not in eval_in_profiles:
|
|
78
|
+
problems.append(
|
|
79
|
+
f"{path}: actions: uses eval in a logged-in profile, so {recipe.name!r} must also "
|
|
80
|
+
"be listed under allow_eval_in_profiles in the config"
|
|
81
|
+
)
|
|
82
|
+
if recipe.hook is not None:
|
|
83
|
+
try:
|
|
84
|
+
load_hook(hooks_dir, recipe.hook)
|
|
85
|
+
except HookError as exc:
|
|
86
|
+
problems.append(f"{path}: hook: {exc}")
|
|
87
|
+
return (None if problems else recipe), problems
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class _Everything:
|
|
91
|
+
"""A collection every name is `in`: used where a per-recipe allow-list does not apply."""
|
|
92
|
+
|
|
93
|
+
def __contains__(self, item: object) -> bool:
|
|
94
|
+
return True
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def load_recipe_file(
|
|
98
|
+
path: Path, site: str, *, allow_eval: bool = True
|
|
99
|
+
) -> tuple[Recipe | None, list[str]]:
|
|
100
|
+
"""Validate ONE recipe file the way the loader does, for recipes that are not yet installed.
|
|
101
|
+
|
|
102
|
+
Used by delivery to inspect incoming recipes. `eval` is allowed here because the caller
|
|
103
|
+
decides what to do with it; hooks are not (no hooks directory), so a recipe naming one is
|
|
104
|
+
reported as a problem.
|
|
105
|
+
"""
|
|
106
|
+
return _load_file(
|
|
107
|
+
path, site, allow_eval=allow_eval, eval_in_profiles=_Everything(), hooks_dir=None
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def load_recipes(
|
|
112
|
+
*directories: Path | None,
|
|
113
|
+
allow_eval: bool = False,
|
|
114
|
+
eval_in_profiles: Collection[str] = (),
|
|
115
|
+
hooks_dir: Path | None = None,
|
|
116
|
+
) -> LoadedRecipes:
|
|
117
|
+
"""Load every recipe under the given directories (later ones override earlier ones)."""
|
|
118
|
+
loaded = LoadedRecipes()
|
|
119
|
+
problems: list[str] = []
|
|
120
|
+
for directory in directories:
|
|
121
|
+
if directory is None:
|
|
122
|
+
continue
|
|
123
|
+
root = directory.expanduser()
|
|
124
|
+
if not root.is_dir():
|
|
125
|
+
problems.append(f"{root}: recipes directory does not exist")
|
|
126
|
+
continue
|
|
127
|
+
for site_dir in sorted(p for p in root.iterdir() if p.is_dir()):
|
|
128
|
+
for path in sorted(site_dir.glob("*.yaml")):
|
|
129
|
+
recipe, found = _load_file(
|
|
130
|
+
path,
|
|
131
|
+
site_dir.name,
|
|
132
|
+
allow_eval=allow_eval,
|
|
133
|
+
eval_in_profiles=eval_in_profiles,
|
|
134
|
+
hooks_dir=hooks_dir,
|
|
135
|
+
)
|
|
136
|
+
problems.extend(found)
|
|
137
|
+
if recipe is not None:
|
|
138
|
+
loaded.recipes[recipe.name] = recipe
|
|
139
|
+
loaded.sources[recipe.name] = path
|
|
140
|
+
if problems:
|
|
141
|
+
raise RecipeLoadError(problems)
|
|
142
|
+
return loaded
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Recipe parameters: declaration, validation of caller input, and `{{name}}` templating.
|
|
2
|
+
|
|
3
|
+
A recipe declares its parameters (name, type, required, default). A caller passes values as
|
|
4
|
+
a query string or JSON body; they are checked against the declaration before anything runs.
|
|
5
|
+
A parameter may appear in the URL path, query or fragment and in action fields, but never
|
|
6
|
+
in the scheme or host, so a caller can never point the browser at a different site.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
from collections.abc import Mapping
|
|
13
|
+
from typing import Any, Literal
|
|
14
|
+
from urllib.parse import quote
|
|
15
|
+
|
|
16
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
17
|
+
|
|
18
|
+
from api_everything.errors import RunError
|
|
19
|
+
|
|
20
|
+
PLACEHOLDER = re.compile(r"\{\{\s*([a-z][a-z0-9_]*)\s*\}\}")
|
|
21
|
+
PARAM_NAME = re.compile(r"^[a-z][a-z0-9_]*$")
|
|
22
|
+
_TRUE = {"true", "1", "yes", "on"}
|
|
23
|
+
_FALSE = {"false", "0", "no", "off"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Param(BaseModel):
|
|
27
|
+
model_config = ConfigDict(extra="forbid")
|
|
28
|
+
|
|
29
|
+
type: Literal["string", "integer", "number", "boolean"] = "string"
|
|
30
|
+
required: bool = True
|
|
31
|
+
default: str | int | float | bool | None = None
|
|
32
|
+
description: str = ""
|
|
33
|
+
# Strings only: longest accepted value, and an optional full-match pattern.
|
|
34
|
+
max_length: int = Field(default=200, ge=1, le=2000)
|
|
35
|
+
pattern: str | None = None
|
|
36
|
+
|
|
37
|
+
@field_validator("pattern")
|
|
38
|
+
@classmethod
|
|
39
|
+
def _compiles(cls, value: str | None) -> str | None:
|
|
40
|
+
if value is not None:
|
|
41
|
+
try:
|
|
42
|
+
re.compile(value)
|
|
43
|
+
except re.error as exc:
|
|
44
|
+
raise ValueError(f"not a valid regular expression: {exc}") from exc
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def placeholders(text: str) -> set[str]:
|
|
49
|
+
"""Names used as `{{name}}` in a string."""
|
|
50
|
+
return set(PLACEHOLDER.findall(text))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _invalid(message: str, name: str) -> RunError:
|
|
54
|
+
return RunError("invalid_params", message, http_status=400, meta={"param": name})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _coerce(name: str, spec: Param, raw: Any) -> str:
|
|
58
|
+
"""Check one value against its declaration and return it as text for templating."""
|
|
59
|
+
if spec.type == "boolean":
|
|
60
|
+
if isinstance(raw, bool):
|
|
61
|
+
return "true" if raw else "false"
|
|
62
|
+
text = str(raw).strip().lower()
|
|
63
|
+
if text in _TRUE:
|
|
64
|
+
return "true"
|
|
65
|
+
if text in _FALSE:
|
|
66
|
+
return "false"
|
|
67
|
+
raise _invalid(f"parameter {name!r} must be a boolean", name)
|
|
68
|
+
if spec.type == "integer":
|
|
69
|
+
if isinstance(raw, bool):
|
|
70
|
+
raise _invalid(f"parameter {name!r} must be an integer", name)
|
|
71
|
+
try:
|
|
72
|
+
return str(int(str(raw).strip()))
|
|
73
|
+
except ValueError:
|
|
74
|
+
raise _invalid(f"parameter {name!r} must be an integer", name) from None
|
|
75
|
+
if spec.type == "number":
|
|
76
|
+
if isinstance(raw, bool):
|
|
77
|
+
raise _invalid(f"parameter {name!r} must be a number", name)
|
|
78
|
+
try:
|
|
79
|
+
number = float(str(raw).strip())
|
|
80
|
+
except ValueError:
|
|
81
|
+
raise _invalid(f"parameter {name!r} must be a number", name) from None
|
|
82
|
+
if number != number or number in (float("inf"), float("-inf")):
|
|
83
|
+
raise _invalid(f"parameter {name!r} must be a finite number", name)
|
|
84
|
+
return str(raw).strip()
|
|
85
|
+
text = str(raw)
|
|
86
|
+
if len(text) > spec.max_length:
|
|
87
|
+
raise _invalid(f"parameter {name!r} is longer than {spec.max_length} characters", name)
|
|
88
|
+
if spec.pattern is not None and not re.fullmatch(spec.pattern, text):
|
|
89
|
+
raise _invalid(f"parameter {name!r} does not match the allowed pattern", name)
|
|
90
|
+
return text
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def bind_params(declared: Mapping[str, Param], given: Mapping[str, Any]) -> dict[str, str]:
|
|
94
|
+
"""Validate caller input against a recipe's declaration; return values as text.
|
|
95
|
+
|
|
96
|
+
Unknown names are errors (a typo fails loudly), missing required ones are errors, and
|
|
97
|
+
defaults fill the rest.
|
|
98
|
+
"""
|
|
99
|
+
unknown = sorted(set(given) - set(declared))
|
|
100
|
+
if unknown:
|
|
101
|
+
raise _invalid(f"unknown parameter(s): {', '.join(unknown)}", unknown[0])
|
|
102
|
+
bound: dict[str, str] = {}
|
|
103
|
+
for name, spec in declared.items():
|
|
104
|
+
if name in given:
|
|
105
|
+
bound[name] = _coerce(name, spec, given[name])
|
|
106
|
+
elif spec.default is not None:
|
|
107
|
+
bound[name] = _coerce(name, spec, spec.default)
|
|
108
|
+
elif spec.required:
|
|
109
|
+
raise _invalid(f"missing required parameter {name!r}", name)
|
|
110
|
+
return bound
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def render(template: str, values: Mapping[str, str], *, url_encode: bool = False) -> str:
|
|
114
|
+
"""Replace `{{name}}` with its value; URL-encode it when filling a URL."""
|
|
115
|
+
|
|
116
|
+
def fill(match: re.Match[str]) -> str:
|
|
117
|
+
value = values.get(match.group(1), "")
|
|
118
|
+
return quote(value, safe="") if url_encode else value
|
|
119
|
+
|
|
120
|
+
return PLACEHOLDER.sub(fill, template)
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"""The recipe format, validated with pydantic.
|
|
2
|
+
|
|
3
|
+
A recipe says: open this URL, optionally do some actions, capture the response that matches
|
|
4
|
+
this rule, optionally reshape it. Everything that can be checked without a browser is
|
|
5
|
+
checked here, at load time, so a bad recipe fails at startup with the file and field named.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import re
|
|
11
|
+
from typing import Any, Literal
|
|
12
|
+
|
|
13
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
|
14
|
+
|
|
15
|
+
from api_everything.errors import RunError
|
|
16
|
+
from api_everything.recipe.actions import Action, Eval, Goto
|
|
17
|
+
from api_everything.recipe.jsonpath import compile_path, find_all
|
|
18
|
+
from api_everything.recipe.params import PARAM_NAME, Param, bind_params, placeholders
|
|
19
|
+
|
|
20
|
+
# `<site>.<endpoint>`, lowercase, for example `reddit.search`.
|
|
21
|
+
RECIPE_NAME = re.compile(r"^[a-z0-9][a-z0-9_-]*\.[a-z0-9][a-z0-9_-]*$")
|
|
22
|
+
HOOK_NAME = re.compile(r"^[a-z][a-z0-9_]*$")
|
|
23
|
+
# Same shape as the profile names the config accepts, so a recipe can never name a profile the
|
|
24
|
+
# config would refuse (or one that escapes the profiles directory).
|
|
25
|
+
SESSION_PROFILE = re.compile(r"^profile:[a-z0-9][a-z0-9_-]{0,63}$")
|
|
26
|
+
# The scheme and host must be literal text: no `{{...}}` before the first path, query or
|
|
27
|
+
# fragment character. This is what keeps a caller from steering the browser to another site.
|
|
28
|
+
_LITERAL_ORIGIN = re.compile(r"^https?://[^/?#{}\s]+(?:[/?#]|$)")
|
|
29
|
+
|
|
30
|
+
JsonType = Literal["string", "integer", "number", "boolean", "list", "object"]
|
|
31
|
+
_TYPE_CHECKS: dict[str, Any] = {
|
|
32
|
+
"string": lambda v: isinstance(v, str),
|
|
33
|
+
"integer": lambda v: isinstance(v, int) and not isinstance(v, bool),
|
|
34
|
+
"number": lambda v: isinstance(v, int | float) and not isinstance(v, bool),
|
|
35
|
+
"boolean": lambda v: isinstance(v, bool),
|
|
36
|
+
"list": lambda v: isinstance(v, list),
|
|
37
|
+
"object": lambda v: isinstance(v, dict),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Matcher(BaseModel):
|
|
42
|
+
"""Which of the page's responses count as the capture."""
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(extra="forbid")
|
|
45
|
+
|
|
46
|
+
# Searched against the FULL response URL, query string included. Anchor it to the API
|
|
47
|
+
# path: a loose pattern can match the page's own document before the API call.
|
|
48
|
+
url_regex: str
|
|
49
|
+
# Statuses that count as a match. None means "any 2xx".
|
|
50
|
+
accept_status: list[int] | None = None
|
|
51
|
+
|
|
52
|
+
@field_validator("url_regex")
|
|
53
|
+
@classmethod
|
|
54
|
+
def _compiles(cls, value: str) -> str:
|
|
55
|
+
try:
|
|
56
|
+
re.compile(value)
|
|
57
|
+
except re.error as exc:
|
|
58
|
+
raise ValueError(f"not a valid regular expression: {exc}") from exc
|
|
59
|
+
return value
|
|
60
|
+
|
|
61
|
+
def accepts_status(self, status: int) -> bool:
|
|
62
|
+
if self.accept_status is None:
|
|
63
|
+
return 200 <= status < 300
|
|
64
|
+
return status in self.accept_status
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Expectation(BaseModel):
|
|
68
|
+
"""One assertion about a live check's result."""
|
|
69
|
+
|
|
70
|
+
model_config = ConfigDict(extra="forbid")
|
|
71
|
+
|
|
72
|
+
path: str
|
|
73
|
+
non_empty: bool = False
|
|
74
|
+
type: JsonType | None = None
|
|
75
|
+
|
|
76
|
+
@field_validator("path")
|
|
77
|
+
@classmethod
|
|
78
|
+
def _valid_path(cls, value: str) -> str:
|
|
79
|
+
compile_path(value)
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
def failures(self, data: Any) -> list[str]:
|
|
83
|
+
"""Why `data` does not satisfy this expectation (empty list means it does)."""
|
|
84
|
+
found = find_all(self.path, data)
|
|
85
|
+
if not found:
|
|
86
|
+
return [f"{self.path}: nothing found"]
|
|
87
|
+
problems: list[str] = []
|
|
88
|
+
if self.non_empty:
|
|
89
|
+
for value in found:
|
|
90
|
+
if value in (None, "", [], {}):
|
|
91
|
+
problems.append(f"{self.path}: found an empty value")
|
|
92
|
+
break
|
|
93
|
+
if self.type is not None and not all(_TYPE_CHECKS[self.type](v) for v in found):
|
|
94
|
+
problems.append(f"{self.path}: not all values are of type {self.type}")
|
|
95
|
+
return problems
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class Check(BaseModel):
|
|
99
|
+
"""What a passing live check is: sample params plus assertions about the result."""
|
|
100
|
+
|
|
101
|
+
model_config = ConfigDict(extra="forbid")
|
|
102
|
+
|
|
103
|
+
params: dict[str, str | int | float | bool] = Field(default_factory=dict)
|
|
104
|
+
expect: list[Expectation] = Field(min_length=1)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class Recipe(BaseModel):
|
|
108
|
+
model_config = ConfigDict(extra="forbid")
|
|
109
|
+
|
|
110
|
+
# The recipe format version. A newer format than this code knows is rejected.
|
|
111
|
+
schema_version: Literal[1]
|
|
112
|
+
name: str = Field(description="`<site>.<endpoint>`, matching the file path")
|
|
113
|
+
# The author's own revision label; free-form.
|
|
114
|
+
recipe_version: str = "1"
|
|
115
|
+
description: str = ""
|
|
116
|
+
# `experimental` recipes are known not to work reliably (a site blocks automated access,
|
|
117
|
+
# or the recipe is unverified). `check --all` skips them unless asked.
|
|
118
|
+
status: Literal["stable", "experimental"] = "stable"
|
|
119
|
+
# Whose identity the run uses: `none` (a fresh isolated context, no saved login) or
|
|
120
|
+
# `profile:<name>` (a named persistent profile the operator signed in to by hand).
|
|
121
|
+
session: str = "none"
|
|
122
|
+
params: dict[str, Param] = Field(default_factory=dict)
|
|
123
|
+
url: str
|
|
124
|
+
actions: list[Action] = Field(default_factory=list, max_length=50)
|
|
125
|
+
matcher: Matcher
|
|
126
|
+
# `first`: return the first match and stop early. `all`: keep matching until the actions
|
|
127
|
+
# finish and the page goes quiet, return every match in arrival order, up to `max_count`.
|
|
128
|
+
collect: Literal["first", "all"] = "first"
|
|
129
|
+
max_count: int = Field(default=20, ge=1, le=1000)
|
|
130
|
+
# After the actions finish, how long the page must stay quiet before the run ends.
|
|
131
|
+
settle_ms: int = Field(default=500, ge=0, le=5000)
|
|
132
|
+
# If the page navigates to a URL matching this, and nothing matched, the run fails with
|
|
133
|
+
# `login_required` (a logged-out session) instead of a vague timeout.
|
|
134
|
+
logged_out_url_regex: str | None = None
|
|
135
|
+
# Optional JSONPath extraction. Each value is always a list of everything the path selects.
|
|
136
|
+
extract: dict[str, str] = Field(default_factory=dict)
|
|
137
|
+
# Name of a local post-processing hook (a file in the operator's hooks directory).
|
|
138
|
+
hook: str | None = None
|
|
139
|
+
check: Check
|
|
140
|
+
|
|
141
|
+
@field_validator("name")
|
|
142
|
+
@classmethod
|
|
143
|
+
def _name_shape(cls, value: str) -> str:
|
|
144
|
+
if not RECIPE_NAME.match(value):
|
|
145
|
+
raise ValueError("must look like '<site>.<endpoint>', lowercase (e.g. reddit.search)")
|
|
146
|
+
return value
|
|
147
|
+
|
|
148
|
+
@field_validator("session")
|
|
149
|
+
@classmethod
|
|
150
|
+
def _session_mode(cls, value: str) -> str:
|
|
151
|
+
if value != "none" and not SESSION_PROFILE.match(value):
|
|
152
|
+
raise ValueError(
|
|
153
|
+
"must be 'none' or 'profile:<name>' (name: lowercase letters, digits, '-', '_')"
|
|
154
|
+
)
|
|
155
|
+
return value
|
|
156
|
+
|
|
157
|
+
@field_validator("params")
|
|
158
|
+
@classmethod
|
|
159
|
+
def _param_names(cls, value: dict[str, Param]) -> dict[str, Param]:
|
|
160
|
+
for name in value:
|
|
161
|
+
if not PARAM_NAME.match(name):
|
|
162
|
+
raise ValueError(f"parameter name {name!r} must be lowercase letters, digits, '_'")
|
|
163
|
+
return value
|
|
164
|
+
|
|
165
|
+
@field_validator("hook")
|
|
166
|
+
@classmethod
|
|
167
|
+
def _hook_name(cls, value: str | None) -> str | None:
|
|
168
|
+
if value is not None and not HOOK_NAME.match(value):
|
|
169
|
+
raise ValueError("hook must be a plain name: lowercase letters, digits and '_'")
|
|
170
|
+
return value
|
|
171
|
+
|
|
172
|
+
@field_validator("logged_out_url_regex")
|
|
173
|
+
@classmethod
|
|
174
|
+
def _logged_out_regex_compiles(cls, value: str | None) -> str | None:
|
|
175
|
+
if value is not None:
|
|
176
|
+
try:
|
|
177
|
+
re.compile(value)
|
|
178
|
+
except re.error as exc:
|
|
179
|
+
raise ValueError(f"not a valid regular expression: {exc}") from exc
|
|
180
|
+
return value
|
|
181
|
+
|
|
182
|
+
@field_validator("extract")
|
|
183
|
+
@classmethod
|
|
184
|
+
def _extract_paths(cls, value: dict[str, str]) -> dict[str, str]:
|
|
185
|
+
for path in value.values():
|
|
186
|
+
compile_path(path)
|
|
187
|
+
return value
|
|
188
|
+
|
|
189
|
+
@model_validator(mode="after")
|
|
190
|
+
def _cross_checks(self) -> Recipe:
|
|
191
|
+
urls = [self.url] + [a.url for a in self.actions if isinstance(a, Goto)]
|
|
192
|
+
for url in urls:
|
|
193
|
+
if not _LITERAL_ORIGIN.match(url):
|
|
194
|
+
raise ValueError(
|
|
195
|
+
f"url {url!r} must start with a literal http(s) scheme and host; "
|
|
196
|
+
"parameters may fill the path, query or fragment, never the host"
|
|
197
|
+
)
|
|
198
|
+
used: set[str] = set()
|
|
199
|
+
for url in urls:
|
|
200
|
+
used |= placeholders(url)
|
|
201
|
+
for action in self.actions:
|
|
202
|
+
if isinstance(action, Eval) and placeholders(action.script):
|
|
203
|
+
# A caller-supplied value pasted into JavaScript would be code injection.
|
|
204
|
+
raise ValueError("an eval script must not contain {{parameters}}")
|
|
205
|
+
for text in _action_strings(action):
|
|
206
|
+
used |= placeholders(text)
|
|
207
|
+
undeclared = sorted(used - set(self.params))
|
|
208
|
+
if undeclared:
|
|
209
|
+
raise ValueError(f"uses undeclared parameter(s): {', '.join(undeclared)}")
|
|
210
|
+
unused = sorted(set(self.params) - used)
|
|
211
|
+
if unused:
|
|
212
|
+
raise ValueError(f"declares parameter(s) that are never used: {', '.join(unused)}")
|
|
213
|
+
try:
|
|
214
|
+
bind_params(self.params, self.check.params)
|
|
215
|
+
except RunError as exc:
|
|
216
|
+
raise ValueError(f"check.params: {exc.message}") from None
|
|
217
|
+
return self
|
|
218
|
+
|
|
219
|
+
@property
|
|
220
|
+
def uses_eval(self) -> bool:
|
|
221
|
+
return any(isinstance(action, Eval) for action in self.actions)
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def profile_name(self) -> str | None:
|
|
225
|
+
"""The profile this recipe runs in, or None for `session: none`."""
|
|
226
|
+
return self.session.removeprefix("profile:") if self.session != "none" else None
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def _action_strings(action: Any) -> list[str]:
|
|
230
|
+
"""Every free-text field of an action, where `{{name}}` may appear."""
|
|
231
|
+
return [
|
|
232
|
+
value
|
|
233
|
+
for key, value in action.model_dump().items()
|
|
234
|
+
if key != "action" and isinstance(value, str)
|
|
235
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
name: alignmentforum.feed
|
|
3
|
+
recipe_version: '1'
|
|
4
|
+
status: stable
|
|
5
|
+
description: AI alignment research posts via Alignment Forum GraphQL XHR.
|
|
6
|
+
session: none
|
|
7
|
+
url: https://www.alignmentforum.org/
|
|
8
|
+
matcher:
|
|
9
|
+
url_regex: www\.alignmentforum\.org/api/search(\?|$)
|
|
10
|
+
collect: first
|
|
11
|
+
check:
|
|
12
|
+
expect:
|
|
13
|
+
- path: $
|
|
14
|
+
non_empty: true
|
|
15
|
+
type: list
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
name: alpine_docs.search
|
|
3
|
+
recipe_version: '1'
|
|
4
|
+
status: stable
|
|
5
|
+
description: Search Alpine.js Docs via browser search modal XHR.
|
|
6
|
+
session: none
|
|
7
|
+
params:
|
|
8
|
+
q:
|
|
9
|
+
type: string
|
|
10
|
+
max_length: 150
|
|
11
|
+
description: Search query for Alpine.js Docs.
|
|
12
|
+
url: https://alpinejs.dev/start-here
|
|
13
|
+
actions:
|
|
14
|
+
- action: wait
|
|
15
|
+
ms: 1800
|
|
16
|
+
- action: click
|
|
17
|
+
selector: button.DocSearch-Button:visible
|
|
18
|
+
- action: wait
|
|
19
|
+
ms: 800
|
|
20
|
+
- action: type
|
|
21
|
+
selector: input.DocSearch-Input:visible
|
|
22
|
+
text: '{{q}}'
|
|
23
|
+
matcher:
|
|
24
|
+
url_regex: sm9gagaukz\-dsn\.algolia\.net/1/indexes/[^/]+/queries(\?|$)
|
|
25
|
+
collect: first
|
|
26
|
+
check:
|
|
27
|
+
params:
|
|
28
|
+
q: xdata
|
|
29
|
+
expect:
|
|
30
|
+
- path: $.results[0].hits
|
|
31
|
+
non_empty: true
|
|
32
|
+
type: list
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
name: angular_docs.search
|
|
3
|
+
recipe_version: '1'
|
|
4
|
+
status: stable
|
|
5
|
+
description: Search Angular Docs via browser search modal XHR.
|
|
6
|
+
session: none
|
|
7
|
+
params:
|
|
8
|
+
q:
|
|
9
|
+
type: string
|
|
10
|
+
max_length: 150
|
|
11
|
+
description: Search query for Angular Docs.
|
|
12
|
+
url: https://angular.dev/overview
|
|
13
|
+
actions:
|
|
14
|
+
- action: wait
|
|
15
|
+
ms: 1800
|
|
16
|
+
- action: click
|
|
17
|
+
selector: button[aria-label*='Search' i]:visible
|
|
18
|
+
- action: wait
|
|
19
|
+
ms: 800
|
|
20
|
+
- action: type
|
|
21
|
+
selector: input[placeholder*='Search' i]:visible
|
|
22
|
+
text: '{{q}}'
|
|
23
|
+
matcher:
|
|
24
|
+
url_regex: l1xwt2uj7f\-dsn\.algolia\.net/1/indexes/[^/]+/queries(\?|$)
|
|
25
|
+
collect: first
|
|
26
|
+
check:
|
|
27
|
+
params:
|
|
28
|
+
q: signal
|
|
29
|
+
expect:
|
|
30
|
+
- path: $.results[0].hits
|
|
31
|
+
non_empty: true
|
|
32
|
+
type: list
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Draft recipe for anthropic_status.summary (status: experimental until promoted).
|
|
2
|
+
# Verify and promote: api-everything promote anthropic_status.summary
|
|
3
|
+
schema_version: 1
|
|
4
|
+
name: anthropic_status.summary
|
|
5
|
+
recipe_version: '1'
|
|
6
|
+
status: stable
|
|
7
|
+
description: Anthropic API and Claude operational status JSON.
|
|
8
|
+
session: none
|
|
9
|
+
url: https://status.anthropic.com/api/v2/summary.json
|
|
10
|
+
matcher:
|
|
11
|
+
url_regex: status\.claude\.com/api/v2/summary\.json(\?|$)
|
|
12
|
+
collect: first
|
|
13
|
+
check:
|
|
14
|
+
expect:
|
|
15
|
+
- path: $.components
|
|
16
|
+
non_empty: true
|
|
17
|
+
type: list
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
name: apis_guru.providers
|
|
3
|
+
recipe_version: '1'
|
|
4
|
+
status: stable
|
|
5
|
+
description: List all public OpenAPI/Swagger providers indexed by APIs.guru.
|
|
6
|
+
session: none
|
|
7
|
+
url: https://api.apis.guru/v2/providers.json
|
|
8
|
+
matcher:
|
|
9
|
+
url_regex: api\.apis\.guru/v2/providers\.json(\?|$)
|
|
10
|
+
collect: first
|
|
11
|
+
check:
|
|
12
|
+
expect:
|
|
13
|
+
- path: $.data
|
|
14
|
+
non_empty: true
|
|
15
|
+
type: list
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Draft recipe for arbeitnow.jobs (status: experimental until promoted).
|
|
2
|
+
# Verify and promote: api-everything promote arbeitnow.jobs
|
|
3
|
+
schema_version: 1
|
|
4
|
+
name: arbeitnow.jobs
|
|
5
|
+
recipe_version: '1'
|
|
6
|
+
status: stable
|
|
7
|
+
description: European and remote engineering job board JSON.
|
|
8
|
+
session: none
|
|
9
|
+
url: https://www.arbeitnow.com/api/job-board-api
|
|
10
|
+
matcher:
|
|
11
|
+
url_regex: www\.arbeitnow\.com/api/job\-board\-api(\?|$)
|
|
12
|
+
collect: first
|
|
13
|
+
check:
|
|
14
|
+
expect:
|
|
15
|
+
- path: $.data
|
|
16
|
+
non_empty: true
|
|
17
|
+
type: list
|
|
18
|
+
- path: $.data[*].title
|
|
19
|
+
non_empty: true
|
|
20
|
+
type: string
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Draft recipe for arin_rdap.ip (status: experimental until promoted).
|
|
2
|
+
# Verify and promote: api-everything promote arin_rdap.ip
|
|
3
|
+
schema_version: 1
|
|
4
|
+
name: arin_rdap.ip
|
|
5
|
+
recipe_version: '1'
|
|
6
|
+
status: stable
|
|
7
|
+
description: IP network registration RDAP JSON via ARIN.
|
|
8
|
+
session: none
|
|
9
|
+
url: https://rdap.arin.net/registry/ip/{{ip}}
|
|
10
|
+
matcher:
|
|
11
|
+
url_regex: rdap\.arin\.net/registry/ip/[^/?#]+(\?|$)
|
|
12
|
+
collect: first
|
|
13
|
+
check:
|
|
14
|
+
expect:
|
|
15
|
+
- path: $.cidr0_cidrs
|
|
16
|
+
non_empty: true
|
|
17
|
+
type: list
|
|
18
|
+
params:
|
|
19
|
+
ip: 8.8.8.8
|
|
20
|
+
params:
|
|
21
|
+
ip:
|
|
22
|
+
type: string
|
|
23
|
+
max_length: 200
|
|
24
|
+
description: Parameter ip for arin_rdap.ip.
|