Skip to content

Commit 07ae539

Browse files
committed
Document the AkismetArguments dictionary.
1 parent 424910a commit 07ae539

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Version 25.10.0
6868
synchronous :class:`~akismet.SyncClient` or asynchronous
6969
:class:`~akismet.AsyncClient` is now mandatory. The legacy ``Akismet`` client
7070
class had been deprecated and raising warnings since version 1.3.
71+
* Added the :class:`~akismet.AkismetArguments` typed dictionary to represent
72+
the set of optional keyword arguments accepted by the comment-check, submit-ham,
73+
and submit-spam API operations.
7174

7275

7376
Version 24.11.0

docs/misc.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,36 @@ Other code and data
99
The following additional items are part of the publicly-exported API of this
1010
module:
1111

12+
.. class:: AkismetArguments
13+
14+
A :class:`~typing.TypedDict` representing the optional keyword arguments
15+
accepted by the comment-check, submit-ham, and submit-spam Akismet API
16+
operations.
17+
18+
The names and types of these optional arguments are:
19+
20+
* ``blog_charset``: :class:`str`
21+
* ``blog_lang``: :class:`str`
22+
* ``comment_author``: :class:`str`
23+
* ``comment_author_email``: :class:`str`
24+
* ``comment_author_url``: :class:`str`
25+
* ``comment_content``: :class:`str`
26+
* ``comment_context``: :class:`str`
27+
* ``comment_date_gmt``: :class:`str`
28+
* ``comment_post_modified_gmt``: :class:`str`
29+
* ``comment_type``: :class:`str`
30+
* ``honeypot_field_name``: :class:`str`
31+
* ``is_test``: :class:`bool`
32+
* ``permalink``: :class:`str`
33+
* ``recheck_reason``: :class:`str`
34+
* ``referrer``: :class:`str`
35+
* ``user_agent``: :class:`str`
36+
* ``user_role``: :class:`str`
37+
38+
For the meanings of these arguments, see `the Akismet web service
39+
documentation <https://akismet.com/developers/detailed-docs/comment-check/>`_.
40+
41+
1242
.. class:: CheckResponse
1343

1444
Possible response values from an Akismet content check, including the

src/akismet/_async_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ async def _post_request(
280280
version: str,
281281
endpoint: str,
282282
user_ip: str,
283-
**kwargs: Unpack[_common.AkismetArguments],
283+
**kwargs: Unpack[akismet.AkismetArguments],
284284
) -> httpx.Response:
285285
"""
286286
Make a POST request to the Akismet API and return the response.
@@ -315,7 +315,7 @@ async def _post_request(
315315
)
316316

317317
async def _submit(
318-
self, endpoint: str, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
318+
self, endpoint: str, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
319319
) -> bool:
320320
"""
321321
Submit ham or spam to the Akismet API.
@@ -340,7 +340,7 @@ async def _submit(
340340
# ----------------------------------------------------------------------------
341341

342342
async def comment_check(
343-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
343+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
344344
) -> akismet.CheckResponse:
345345
"""
346346
Check a piece of user-submitted content to determine whether it is spam.
@@ -391,7 +391,7 @@ async def comment_check(
391391
)
392392

393393
async def submit_ham(
394-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
394+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
395395
) -> bool:
396396
"""
397397
Inform Akismet that a piece of user-submitted comment is not spam.
@@ -433,7 +433,7 @@ async def submit_ham(
433433
return await self._submit(_common._SUBMIT_HAM, user_ip, **kwargs)
434434

435435
async def submit_spam(
436-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
436+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
437437
) -> bool:
438438
"""
439439
Inform Akismet that a piece of user-submitted comment is spam.

src/akismet/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
class AkismetArguments(TypedDict, total=False):
5555
"""
5656
A :class:`~typing.TypedDict` representing the optional keyword arguments accepted by
57-
most Akismet API operations.
57+
the comment-check, submit-ham, and submit-spam Akismet API operations.
5858
5959
"""
6060

src/akismet/_sync_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def _post_request(
279279
version: str,
280280
endpoint: str,
281281
user_ip: str,
282-
**kwargs: Unpack[_common.AkismetArguments],
282+
**kwargs: Unpack[akismet.AkismetArguments],
283283
) -> httpx.Response:
284284
"""
285285
Make a POST request to the Akismet API and return the response.
@@ -314,7 +314,7 @@ def _post_request(
314314
)
315315

316316
def _submit(
317-
self, endpoint: str, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
317+
self, endpoint: str, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
318318
) -> bool:
319319
"""
320320
Submit ham or spam to the Akismet API.
@@ -337,7 +337,7 @@ def _submit(
337337
# ----------------------------------------------------------------------------
338338

339339
def comment_check(
340-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
340+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
341341
) -> akismet.CheckResponse:
342342
"""
343343
Check a piece of user-submitted content to determine whether it is spam.
@@ -388,7 +388,7 @@ def comment_check(
388388
)
389389

390390
def submit_ham(
391-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
391+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
392392
) -> bool:
393393
"""
394394
Inform Akismet that a piece of user-submitted comment is not spam.
@@ -430,7 +430,7 @@ def submit_ham(
430430
return self._submit(_common._SUBMIT_HAM, user_ip, **kwargs)
431431

432432
def submit_spam(
433-
self, user_ip: str, **kwargs: Unpack[_common.AkismetArguments]
433+
self, user_ip: str, **kwargs: Unpack[akismet.AkismetArguments]
434434
) -> bool:
435435
"""
436436
Inform Akismet that a piece of user-submitted comment is spam.

0 commit comments

Comments
 (0)