From 868ad61ed547e304251f5b4363fc1ef4f6ad14a3 Mon Sep 17 00:00:00 2001 From: Ali Hesari Date: Sun, 30 Aug 2026 12:24:09 +0200 Subject: [PATCH 1/3] fix(client): target /v1 instead of the 404 /api/v1 path The API serves its routes at https://api.fopost.com/v1; /api/v1 returns 404, so every request the published 0.1.2 client made was dead. --- README.md | 4 ++-- examples/create_post.py | 2 +- src/fopost/_http.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4db254d..c83cc52 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ repurposed = client.ai.repurpose_url( ```python Fopost( api_key="fp_...", # or FOPOST_API_KEY - base_url="https://api.fopost.com/api/v1", # override for a dev server + base_url="https://api.fopost.com/v1", # override for a dev server timeout=30.0, # seconds, or an httpx.Timeout max_retries=3, # total attempts on a 429 http_client=my_httpx_client, # bring your own transport @@ -200,7 +200,7 @@ running API: ```bash export FOPOST_API_KEY=fp_... -export FOPOST_BASE_URL=http://localhost:8080/api/v1 +export FOPOST_BASE_URL=http://localhost:8080/v1 python examples/create_post.py "Hello from the Python SDK" --publish ``` diff --git a/examples/create_post.py b/examples/create_post.py index a2ee617..efef6e4 100644 --- a/examples/create_post.py +++ b/examples/create_post.py @@ -3,7 +3,7 @@ Point it at a local dev API: export FOPOST_API_KEY=fp_... - export FOPOST_BASE_URL=http://localhost:8080/api/v1 + export FOPOST_BASE_URL=http://localhost:8080/v1 python examples/create_post.py "Hello from the Python SDK" Without --publish it stops at a draft, so you can run it against a real diff --git a/src/fopost/_http.py b/src/fopost/_http.py index 9f5111c..69076d8 100644 --- a/src/fopost/_http.py +++ b/src/fopost/_http.py @@ -11,7 +11,7 @@ from .errors import FopostError, RateLimitError, error_from_response -DEFAULT_BASE_URL = "https://api.fopost.com/api/v1" +DEFAULT_BASE_URL = "https://api.fopost.com/v1" DEFAULT_TIMEOUT = 30.0 DEFAULT_MAX_RETRIES = 3 MAX_RETRY_WAIT = 60.0 From a4478e562d02122e88b8475b1de1d5ac303adbdb Mon Sep 17 00:00:00 2001 From: Ali Hesari Date: Sun, 30 Aug 2026 12:24:09 +0200 Subject: [PATCH 2/3] test(client): pin the request URL to /v1 and reject /api/v1 --- tests/conftest.py | 2 +- tests/test_client.py | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0d1d302..2560da4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,7 @@ from fopost import Fopost -BASE_URL = "https://api.test.fopost.com/api/v1" +BASE_URL = "https://api.test.fopost.com/v1" API_KEY = "osk_test_key" diff --git a/tests/test_client.py b/tests/test_client.py index fe71dfc..c97a81e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -23,13 +23,28 @@ def test_the_api_key_falls_back_to_the_environment(monkeypatch: pytest.MonkeyPat assert client._http.api_key == "osk_from_env" -def test_the_default_base_url_includes_the_api_version() -> None: - assert DEFAULT_BASE_URL == "https://api.fopost.com/api/v1" +def test_the_default_base_url_is_the_documented_v1_path() -> None: + assert DEFAULT_BASE_URL == "https://api.fopost.com/v1" + assert "/api/v1" not in DEFAULT_BASE_URL with Fopost(api_key=API_KEY) as client: assert client.base_url == DEFAULT_BASE_URL +@respx.mock +def test_requests_go_to_v1_and_never_to_the_404_api_v1_path() -> None: + route = respx.get("https://api.fopost.com/v1/workspaces").mock( + return_value=httpx.Response(200, json={"data": []}) + ) + + with Fopost(api_key=API_KEY) as client: + client.workspaces.list() + + url = str(route.calls.last.request.url) + assert url.startswith("https://api.fopost.com/v1/") + assert "/api/v1/" not in url + + def test_a_trailing_slash_on_the_base_url_does_not_double_up() -> None: with Fopost(api_key=API_KEY, base_url=f"{BASE_URL}/") as client: assert client.base_url == BASE_URL From 704ffca95506451dec179c53bae02b4cd89368bc Mon Sep 17 00:00:00 2001 From: Ali Hesari Date: Sun, 30 Aug 2026 12:24:09 +0200 Subject: [PATCH 3/3] chore(release): bump to 0.1.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5bbac2d..96e7f10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "fopost" -version = "0.1.2" +version = "0.1.3" description = "Official Python SDK for the FoPost API. Schedule and publish to +30 social platforms from your code." readme = "README.md" license = "MIT"