makememe 0.1.2__tar.gz → 0.1.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makememe
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A tiny zero-dependency CLI for generating memes via the free memegen.link API. Agent-friendly.
5
5
  Project-URL: Homepage, https://pypi.org/project/makememe/
6
6
  Project-URL: memegen.link API, https://api.memegen.link
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "makememe"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  description = "A tiny zero-dependency CLI for generating memes via the free memegen.link API. Agent-friendly."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -26,9 +26,13 @@ uv tool install makememe
26
26
  meme --list --json
27
27
  ```
28
28
 
29
- Common ids: `drake`, `db` (distracted boyfriend), `buttons` (two buttons),
30
- `gru` (gru's plan), `cmm` (change my mind), `fine` (this is fine),
31
- `success` (success kid), `rollsafe`, `same` (same picture), `regret`.
29
+ Common ids: `drake`, `db` (distracted boyfriend), `ds` (daily struggle /
30
+ "two buttons"), `gru` (gru's plan), `cmm` (change my mind),
31
+ `fine` (this is fine), `success` (success kid), `rollsafe`,
32
+ `same` (same picture), `regret`.
33
+
34
+ **Always verify an id with `meme --list --json` before using it** — guessing
35
+ ids (e.g. `buttons`, `twobuttons`) leads to 404s. When unsure, list first.
32
36
 
33
37
  2. **Generate.** Pass the template id then the caption lines in order. Use
34
38
  `--json` so you can capture the output path reliably:
@@ -193,10 +193,21 @@ def _run(argv=None):
193
193
  try:
194
194
  n = download(url, args.out)
195
195
  except Exception as e:
196
+ # a 404 almost always means a bad template id — point the user/agent at --list
197
+ hint = None
198
+ if getattr(e, "code", None) == 404 and not args.bg:
199
+ hint = (f"template '{template}' not found (404). "
200
+ "Run `meme --list` to find the correct id.")
196
201
  if args.json:
197
- print(json.dumps({"error": str(e), "url": url}))
202
+ out = {"error": str(e), "url": url}
203
+ if hint:
204
+ out["hint"] = hint
205
+ print(json.dumps(out))
198
206
  sys.exit(1)
199
- sys.exit(f"download failed: {e}\nurl was: {url}")
207
+ msg = f"download failed: {e}\nurl was: {url}"
208
+ if hint:
209
+ msg += f"\nhint: {hint}"
210
+ sys.exit(msg)
200
211
 
201
212
  if args.json:
202
213
  print(json.dumps({"path": args.out, "bytes": n, "url": url}))
@@ -93,6 +93,19 @@ class TestCrashSafety(unittest.TestCase):
93
93
  finally:
94
94
  cli.download = orig
95
95
 
96
+ def test_404_adds_list_hint(self):
97
+ class FakeHTTPError(Exception):
98
+ code = 404
99
+ orig = cli.download
100
+ cli.download = lambda *a, **k: (_ for _ in ()).throw(FakeHTTPError("404"))
101
+ try:
102
+ buf = io.StringIO()
103
+ with redirect_stdout(buf), redirect_stderr(io.StringIO()):
104
+ self.assertEqual(self._exit_code(["buttons", "a", "b", "--json"]), 1)
105
+ self.assertIn("meme --list", buf.getvalue())
106
+ finally:
107
+ cli.download = orig
108
+
96
109
  def test_download_failure_is_clean_exit_in_json(self):
97
110
  orig = cli.download
98
111
  cli.download = lambda *a, **k: (_ for _ in ()).throw(OSError("boom"))
File without changes
File without changes
File without changes